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


Problems Including Files

Recommended Posts

Trajar    122
For my header files, I use the standard #ifndef _MYINCLUE_H #define _MYINCLUE_H #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 // stuff #endif Anyhow, when adding a few new include files to my project, things started to get wierd. When I would include the file once in WinMain.cpp, it wouldn''t load it again in any of the other modules. I know this is what it''s supposed to do, keeping compile times down and all, but I''m getting errors like: base class undefined missing storage-class or type specifiers which means it isn''t loading the reading the classes. I know I sound really stupid, but this has worked for a while. So what am I overlooking? Thanks in advance

Share this post

Link to post
Share on other sites
shamen    122
One common mistake is to have cyclic references ie:

#ifndef __FILE1_H__
#define __FILE1_H__

#include "file2.h"

// My other defines

#endif // __FILE1_H__

#ifndef __FILE2_H__
#define __FILE2_H__

#include "file1.h"

// My other defines

#endif // __FILE2_H__

The compiler doesnt know which to process first. This will cause problems with things not being found.

Also make sure of obvious things, like you are including the file with your definition in it BEFORE it is used.

As headers get more complex, it is easy to overlook things like this.

Edited by - shamen on July 19, 2000 2:53:11 PM

Share this post

Link to post
Share on other sites