Archived

This topic is now archived and is closed to further replies.

Jbs

PCH Errors

Recommended Posts

Hi, I recently re-installed Visual C++ and am now receiving hundreds of PCH errors whenever I use classes. The previous installation did not have this problem. A quick search on google revealed that the compiler was finding error with some of my pre-compiled headers and that I should check my compiler documentation to fix the problem. In doing so, I found no solution. Also, I found that unincluding the headers in my project did not resolve the problem at all so I doubt that it is really the headers that I am including that are causing the problems. I also recently found that if put the class definitions all in the same file the errors will go away, but if I seperate the class into a .h and a .cpp I get a PCH error for each class method. E.g.
//test.h

class MyClass
{
    public:
       MyClass();
};
//test.cpp

#include "test.h"

MyClass::MyClass()
{
//foo

}
This will not work, but the code below does.
//test.h

class MyClass
{
   public:
      MyClass()
      {
          //foo

      }
};
Has anyone received these errors and somehow fixed them? Does anyone have a clue as to how I can even start fixing this problem. Thank You.

Share this post


Link to post
Share on other sites
ive gotten PCH problems sometimes too. i had the problem because i did not put the semi colon after the class prototype. the reason it is probably working when you combine the two is because when it is that way the compiler treats it as in-line functions. check your class definition syntax.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you really get stuck and just want it to work you could just disable the use of precompiled headers in the project settings.

Share this post


Link to post
Share on other sites
yeah, i''ve looked at my class structure. It''s good. I was wondering if somehow I changed an actual compiler setting that would cause these errors?

Share this post


Link to post
Share on other sites