redeclaration of C++ built-in type
Started by Wavesonics, Jul 27 2004 07:15 PM
31 replies to this topic
#1 Members - Reputation: 330
Posted 27 July 2004 - 07:15 PM
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!
Sponsor:
#5 Moderators - Reputation: 1650
Posted 27 July 2004 - 07:50 PM
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.
#6 Members - Reputation: 330
Posted 27 July 2004 - 07:52 PM
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
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
#9 Members - Reputation: 330
Posted 27 July 2004 - 08:25 PM
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
#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
#10 Members - Reputation: 293
Posted 27 July 2004 - 08:27 PM
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 -
...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 -
#12 Moderators - Reputation: 1650
Posted 27 July 2004 - 08:31 PM
Look in the header file see if there are references to glutInitWithExit, glutCreateWindowWithExit and glutCreateWindowWithExit, like, for example, taking their address (function pointers?).
You can also get your preprocessor to dump the list of macros it has implicitely defined (IIRC, cpp -dM) -- see if things are different in the project that worked. Or compare the preprocessed output, see if the naughty bits are taken out somehow, or actually made correct.
Does MinGW-g++ need to link to other libraries to provide WinMain, or is that the usual entry point?
Also, see if using FreeGLUT makes things better.
You can also get your preprocessor to dump the list of macros it has implicitely defined (IIRC, cpp -dM) -- see if things are different in the project that worked. Or compare the preprocessed output, see if the naughty bits are taken out somehow, or actually made correct.
Does MinGW-g++ need to link to other libraries to provide WinMain, or is that the usual entry point?
Also, see if using FreeGLUT makes things better.
#13 Members - Reputation: 122
Posted 27 July 2004 - 08:36 PM
i am no expert in this but i have had the same sort of problems while trying to compile managed types with none managed types, i would suggest this if you do not want to use a 3rd party glut.
it may solve your problem but may also create more problems i am unsure of this.
(edit: ignore me if u feel the need as i am probably to inexperienced in this to be of any help)
#undef wchart_t
#include <glut.h>
it may solve your problem but may also create more problems i am unsure of this.
(edit: ignore me if u feel the need as i am probably to inexperienced in this to be of any help)
#15 Members - Reputation: 330
Posted 27 July 2004 - 08:43 PM
Ok that project I thought was working is only using gl and glu...
But Dev C++ generates templates 1 of which is a basic open GL window which WAS compiling eariler 2 nite and now does not. So I just need to reset all my fucking headers and libs. This FreeGlut seems to b native to Linux, having a lil trouble finding the win32 binaries but ill keep looking.
But Dev C++ generates templates 1 of which is a basic open GL window which WAS compiling eariler 2 nite and now does not. So I just need to reset all my fucking headers and libs. This FreeGlut seems to b native to Linux, having a lil trouble finding the win32 binaries but ill keep looking.






