Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 C++ Intellisense error

I am getting a strange Intellisense error in VS 2010. I searched the Internet with no luck. It seem that no one else got this error before.

IntelliSense: PCH warning: header stop needs to be at global scope. 
An intellisense PCH file was not generated.

Following this many other errors as it stops indexing. This happens to the recent files that I have added. I have many files in my project (278) and this happens to the most recent 5-6 of them. May be I did something it doesn't like or may be there is a limitation.

Since I couldn't found this error even in the documentation, I would like to learn the reason as well as a possible solution. Note that, I have tried to delete ipch folder and sdf file to get them generated a new. The error is given to the last line of a file. My code heavily uses templates.

EDIT:
I noticed my ipch folder is mostly empty. This probably means that entire precompiled header generation fails, rather for those files. Still, intellisense partially works, but not for those files.

like image 819
Cem Kalyoncu Avatar asked Dec 05 '22 18:12

Cem Kalyoncu


1 Answers

This error is generated when you forget a ";" after a class declaration, for example:

#ifndef _MYCLASS_H
class MyClass {
...
public:
...
}

#endif <--- VS2010 report here the error PCH: warning...

If you put a ";" after the closing "}" the error go away. I'm not saying this is the only cause, I'm just saying that I found that error with the missing ";" in the mentioned place.

like image 65
Gustavo Rodríguez Avatar answered Jan 23 '23 16:01

Gustavo Rodríguez