Tuesday, October 20, 2015

PCH Warning in Visual C++

The following error was observed in Microsoft Visual C++ 2010 edition.

Error:
Error: PCH Warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated.

Problem code:

[file name : perCoreUsage.h] 

#ifndef perCoreUsage
#define perCoreUsage

void perCoreUsageCall();

#endif

Solution-1

Add the following line in your header file perCoreUsage.h:
#pragma once

Solution-2

Use your header file in some CPP file like perCoreUsage.cpp or main.cpp:
#include "perCoreUsage.h"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.