Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

redeclaration of C++ built-in type


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
31 replies to this topic

#1 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

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:

#2 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 07:22 PM

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...

#3 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

Posted 27 July 2004 - 07:22 PM

Are you sure your glut.h header matches the library file you are using?

#4 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 07:41 PM

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?

#5 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

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 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

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

#7 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

Posted 27 July 2004 - 08:02 PM

*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...

#8 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 08:09 PM

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...

#9 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

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

#10 Acid-Chris   Members   -  Reputation: 293

Like
0Likes
Like

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 -

#11 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 08:30 PM

Just realized why that 1 project worked.

It's not using Glut. only gl and glu... feck feck feck FEEECCKK!!!

Time to blast some shit in halo...

#12 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

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.

#13 Zyme   Members   -  Reputation: 122

Like
0Likes
Like

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.



#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)

#14 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

Posted 27 July 2004 - 08:38 PM

wchar_t is not a macro, it's a built-in type, just like char, short, int, long, float and double are.

#15 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

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.

#16 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 08:45 PM

OH SWEETNESS!!! they have a free glut package specificaly for dev c++!!! I LOVE U GUY!!!

#17 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 08:52 PM

oo... ssoo... close...

All the errors are gone except this:

76 C:\Dev-Cpp\my code\openGL\my code\template\main.cpp
`exit' undeclared (first use this function)

#18 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 08:57 PM

I do a compile of just:

#include <GL/freeglut.h>

and get the following error:

cannot find -llibfreeglut

WTF!!!! i know its there im looking at the damn thing!

#19 Fruny   Moderators   -  Reputation: 1650

Like
0Likes
Like

Posted 27 July 2004 - 09:01 PM

Check your library path.
exit() is declared in <stdlib.h>/<cstdlib>

#20 Wavesonics   Members   -  Reputation: 330

Like
0Likes
Like

Posted 27 July 2004 - 09:08 PM

awesome ok fixxed the exit problem. Now no matter which lib i use it says it cant b found...

Both the libfreeglut.a and libglut32.a
opengl really does hate :(....

so close too so close...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS