开发者

Organizing files in Visual C++ project

开发者 https://www.devze.com 2023-01-20 09:26 出处:网络
I\'m writing a project in Visual C++ 2010 Express edition. Everything was fine before I tried to add new source file in the project. Then when I tried to include one of the header files the compiler s

I'm writing a project in Visual C++ 2010 Express edition. Everything was fine before I tried to add new source file in the project. Then when I tried to include one of the header files the compiler said that the class declared in this header is not found in other source file which includes the same header file.

This is output from build. I've added #pragma message in each header file to see when it is included.

1>------ Build started: Project: OSGF, Configuration: Debug Win32 ------
1>  OSGFComponentManager.cpp
1>      OSGFComponentManager.h included
1>      OSGFComponent.h included
1>      Game.h included
1>      GameTimer.h Included
1>      ScreenText.h included
1>      OSGFDrawableComponent.h icluded
1>d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(7): error C2504: 'OSGFComponent' : base class undefined
1>d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(10): error C2061: syntax error : identifier 'Game'
1>d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(10): error C2065: 'game' : undeclared identifier
1>d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(12): error C2614: 'OSGFDrawableComponent' : illegal member initialization: 'OSGFComponent' is not a base or member
1>d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(16): error C2027: use of undefined type 'OSGFComponent'
1>          d:\myprograms\osgf\osgf\osgfdrawablecomponent.h(4) : see declaration of 'OSGFComp开发者_如何学JAVAonent'
1>d:\myprograms\osgf\osgf\screentext.h(11): error C2061: syntax error : identifier 'Game'
1>  Generating Code...
1>  Compiling...
1>  Main.cpp
1>      Test.h included
1>      Game.h included
1>      GameTimer.h Included
1>      ScreenText.h included
1>      OSGFDrawableComponent.h icluded
1>      OSGFComponent.h included
1>  Generating Code...
1>  Compiling...
1>  Test.cpp
1>      Test.h included
1>      Game.h included
1>      GameTimer.h Included
1>      ScreenText.h included
1>      OSGFDrawableComponent.h icluded
1>      OSGFComponent.h included
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========  


Have you included OSGFComponent.h and Game.h in the osgfdrawablecomponent.h header file ?


I guess the header containing the definition of OSGFComponent must be included eigther in osgfdrawablecomponent.h or OSGFComponentManager.cpp in before including osgfdrawablecomponent.h

0

精彩评论

暂无评论...
验证码 换一张
取 消