Jump to content
  • Advertisement
Sign in to follow this  
Bimble Bob

Cannot find identifier

This topic is 4452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Strange problem. I have this in a header file called say Thing.h: #include "IDFRoot.h" namespace ANameSpace { extern DFRESULT createRoot(bool bLog, const float DFENGINEVERSION, LPIDFROOT *pIRoot); } Now LPIDFROOT is defined in IDFRoot.h like this: class IDFRoot { //Blah }; typedef class IDFRoot *LPIDFROOT; Now with that when i compile I get this error: Thing.h: error C2061: syntax error : identifier 'LPIDFROOT' It compiles fine if were to put the createRoot() declaration in IDFRoot.h just under the typedef but when I try to use the function in my Apps I get an Undefined external symbol. I'm not quite sure what I'm doign wrong so any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
The only time I've had problems like this is when I used the same preprocessor symbol for the include guards in two files (Damn copy & paste errors...)
Something like:

Thing.h:

#ifndef __THING_H__
#define __THING_H__

#include "IDFRoot.h"

// Code

#endif // __THING_H__



IDFRoot.h:

#ifndef __THING_H__
#define __THING_H__

// Code

#endif // __THING_H__


Share this post


Link to post
Share on other sites
OK I fixed the inclusion guards (They were missing alltogether :S) and now none of my classes work. Each class includes Thing.h which in turn includes each class header file. So in theory each class has access to the others. But this isn't happening for some reason.

Share this post


Link to post
Share on other sites
It works if I include all the files included in Thing.h directly into IDFRoot.h. It'll do as a temporary fix so I can work out why using this in my Apps gives me Access Violation errors.

Share this post


Link to post
Share on other sites
You should try to minimize includes as much as you can. It seems simpler to design it so everything can access everything else, but this causes serious headaches later.

I'd remove all of your include directives and add them back one by one until you get rid of compiler errors.

Share this post


Link to post
Share on other sites
Will do. And I'm very pleased with myself. I can now create a window on any OS in only 3 lines of code. May not sound like much but I'm pleased!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!