Weird error in VC++ 6.0
Hi!
I get this peculiar error when I try to build my projects.
"c:\myprojects\sp3d\spinput.h(23) : error C2146: syntax error : missing '';'' before identifier ''lpdi''
c:\myprojects\sp3d\spinput.h(23) : fatal error C1004: unexpected end of file found"
I am pretty sure there isn''t a '';'' missing. These are the files in my project:
- main.cpp , includes both .h-files
- sp3d.cpp|h, the .cpp includes the sp3d.h file
- spinput.cpp|h, the .cpp includes the spinput.h file
Whenever I include the spinput.h in main.cpp I get this error even if the ''extern LPDIRECTINPUT lpdi;'' isn''t the first line of code in the file.
The LPDIRECTINPUT-object is declared in spinput.cpp.
This is not the only time this has happend. I have another project with 4 headerfiles and one of them behaves in the exact same way. Without it, it compiles just fine.
If any of you have gotten this error before, I''m sure you know what I''m talking about.
I''d appreciate it if you could help me with this (to me) weird error.
Jarle
Are you really sure you havn''t forgotten a ; last in the declaration of a structure or class. I do this all the time:
---- hello.h ----
#ifndef hello_h
#define hello_h
struct hello
{
int very_welcome;
}
#endif
---- end ----
when it should be:
---- hello.h ----
#ifndef hello_h
#define hello_h
struct hello
{
int very_welcome;
}; // <<<<< ------ NOTE THE ;
#endif
---- end ----
---- hello.h ----
#ifndef hello_h
#define hello_h
struct hello
{
int very_welcome;
}
#endif
---- end ----
when it should be:
---- hello.h ----
#ifndef hello_h
#define hello_h
struct hello
{
int very_welcome;
}; // <<<<< ------ NOTE THE ;
#endif
---- end ----
September 14, 2000 01:48 PM
OK, I have just started looking into DirectX programming and I think I know your problem (thats how basic it is).
Did you read and follow all the warnings about configuring your compiler directories to compile with the DirectX SDK.
Specifically, you must have the mssdk\include directory first in the list so it finds it before it finds the same files in the Visual Studio include directories.
Hope this helps!
Bob D.
Did you read and follow all the warnings about configuring your compiler directories to compile with the DirectX SDK.
Specifically, you must have the mssdk\include directory first in the list so it finds it before it finds the same files in the Visual Studio include directories.
Hope this helps!
Bob D.
If you''re compiling with MFC (shudder) make sure you include ''stdafx.h''. Not including it causes that error.
If that''s not the case, maybe you could post the code or a link to it? Hard to say offhand without seeing it.
Rath
If that''s not the case, maybe you could post the code or a link to it? Hard to say offhand without seeing it.
Rath
____________________________________________________
"Two wrongs do not make a right; it usually takes 3 or more."
____________________________________________________
"Two wrongs do not make a right; it usually takes 3 or more."
Some mistakes are too much fun to only make once.
Never anger a dragon, for you are crunchy and you go well with brie.
Actually, Rath, that''s not possible in this case. If it expects stdafx.h, it will say "End of file found while looking for precompiled header." If you don''t want a precompiled header when you get this error, all you have to do is go to Project->Settings, click on the C/C++ tab, set the Category combo box to "Precompiled Headers", and click the "Not using precompiled headers" button. Note that you must do this both for Debug and Release versions.
-fel
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Problem is it doesn't know what LPDIRECTINPUT is when it tries to compile main.cpp. Confusing error that doesn't tell you the real problem.
If you have "'extern LPDIRECTINPUT lpdi;" declared in a header file, make sure dinput.h is included before that header file. You said you try to include "spinput.h" in your main.cpp. Make sure dinput.h is before spinput.h.
Or you can put #include dinput.h at the top of sinput.h
- Modian
www.illusia.com
Edited by - Modian on September 14, 2000 4:18:24 PM
If you have "'extern LPDIRECTINPUT lpdi;" declared in a header file, make sure dinput.h is included before that header file. You said you try to include "spinput.h" in your main.cpp. Make sure dinput.h is before spinput.h.
Or you can put #include dinput.h at the top of sinput.h
- Modian
www.illusia.com
Edited by - Modian on September 14, 2000 4:18:24 PM
----------------------
Modian
Modian
Thanks, felisandria. You''re right ofcourse. Been so long since I swore never to touch MFC again I''d forgotten
____________________________________________________
"Two wrongs do not make a right; it usually takes 3 or more."
____________________________________________________
"Two wrongs do not make a right; it usually takes 3 or more."
Some mistakes are too much fun to only make once.
Never anger a dragon, for you are crunchy and you go well with brie.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement