redeclaration of C++ built-in type

Started by
33 comments, last by Kylotan 6 years, 9 months ago
I'm trying to get OpenGL set up with Dev C++ and it's not going so well... I get this error when I try to compile. 50 C:\Dev-Cpp\include\GL\glut.h redeclaration of C++ built-in type `wchar_t' From when I can gather I'm not the only 1 w\ this problem. This problem is the standard is there can not be two identical type defs. The reason this isn't a show stopper is VC++ isn't standards compliant, it just lets anything fly. So all VC++ users are fine, don't ever know this conflict exists. But the rest of us using standards compliant compilers such as Dev C++'s MinGW or what ever they call it... any way no 1 i have found so far has figured a solution, PLZ HELP!
==============================
A Developers Blog | Dark Rock Studios - My Site
Advertisement
UPDATE:
I commented out line 50 and that error goes away.

But then I get 10 million link errors :(
example:

[Linker error] undefined reference to `__glutInitWithExit'

wtf why does the opengl god hate me so...
==============================
A Developers Blog | Dark Rock Studios - My Site
Are you sure your glut.h header matches the library file you are using?
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Yes both are from Nate or who the guy who ported it to win32 was.

Is the commenting out line 50 a good idea or should i find a different work around?
==============================
A Developers Blog | Dark Rock Studios - My Site
Quote:Original post by Wavesonics
Is the commenting out line 50 a good idea or should i find a different work around?


Sure, hack it away - if the header doesn't work, it does you no good. I did the same thing when I started using VS.NET, which had changed the declaration for exit() and abort() - adding a noreturn attribute.

Your best bet in any case would be to recompile GLUT from source, that way, you'd be sure everything is clean. May I suggest FreeGLUT? Unlike the original GLUT, it is still being maintained, and the license terms are better (you can redistribute a modified copy). It also comes with a Dev-C++ package, apparently.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
awesome thx man. Ok got an interesting development. Some 1 in another forum linked me 2 some OpenGL projects and I compiled 1 of them and ya know what?

NO LINK ERRORS!!!! WTF?! they use the exact same include I do for glut.h!

Heres the difference. It's a "Project" so it has it's own link parameters. But I copied them strait into my global link parameters so everything compiled should be the same now. But my sample code is still busted. How could 1 give me link errors and 1 not?!

Heres the exact linking I use:
-L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lglut32
==============================
A Developers Blog | Dark Rock Studios - My Site
*shrug* Your compiler hates you?

No, really, I don't know. Check that all the settings match, including library path options (-L) and so on and so forth...

edit - hmmm, ok...
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
ya it really really does hate me :(... it's gotta b something w\ the code or something i have no idea. just doesnt make sense this 1 project would compile while the other would give linking errors...
==============================
A Developers Blog | Dark Rock Studios - My Site
I just compile a file with:

#include <GL/glut.h>

thats it and i still get 3 errors... Heres the full compile log:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\test\stupid.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\test\stupid.exe" -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\include\GL" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lglut32
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x15):stupid.cpp: undefined reference to `__glutInitWithExit'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x30):stupid.cpp: undefined reference to `__glutCreateWindowWithExit'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x4c):stupid.cpp: undefined reference to `__glutCreateMenuWithExit'
C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

Execution terminated
==============================
A Developers Blog | Dark Rock Studios - My Site
MAN....it's always the same, on every compiler, on every platform,...CHECK YOUR PROJECT AND LINKER SETTINGS!!!

...But if you cannot setup your little program to compile properly what if you're getting _real_ compile errors? Post them immediately to some boards?? Fine! *being sarcastic* :(

I'm sure we hear from you again if you add another 3rd party library...*gg*

best regards
- christoph -

This topic is closed to new replies.

Advertisement