tags:

views:

653

answers:

4

Original Question:

[Warning] passing GLfloat' for converting 2 of void glutSolidSphere(GLdouble, GLint, GLint)'
[Warning] passing GLfloat' for converting 3 of void glutSolidSphere(GLdouble, GLint, GLint)'


After applying one of the poster's suggestions of including glut.h, I now get this problem.

I can't use glutSolidSphere() without it.

[Linker error] undefined reference to `__glutInitWithExit@12'

[Linker error] undefined reference to `__glutCreateWindowWithExit@8'

[Linker error] undefined reference to `__glutCreateMenuWithExit@8'

[Linker error] undefined reference to `glutSolidSphere@16'

I'm using DEV C++, if that helps.

+1  A: 

That looks mangled. Perhaps it's telling you that you're passing a GLfloat where a GLint was expected, as the 2nd and 3rd arguments? Please paste your exact error/warning output again, this doesn't look right.

unwind
+1  A: 

The 'slices' and 'stacks' params are supposed to be integers; your code is passing in floats.

Edit: you really shouldn't edit your question to make it a completely different question. Undefined Reference means that you aren't linking in the library that contains those functions. You need to include GLuT in the list of libraries you're linking against.

DNS
oh!silly me.. =.=||
noob88
+1  A: 

As DNS said, but in simpler terms:

You need to link the GLUT library. I believe it is usually glut32.lib on Win32 machines. There should be an option for this somewhere in the project properties pages of your IDE; Sorry, I don't use Dev-C++, but in Visual Studio it is in the project properties, and then linker settings, and "Additional Library Includes".

Ricket
A: 

Pass -lglut32 option to mingw's linker - Dev-Cpp uses mingw.

You'll have to find "linker options" textbox somewhere in Project Options. Sorry I cannot be more specific than that, it's been over a year since I used Dev-Cpp, and over three years since I really used it. It should be the same place where you added -lopengl32 and -lglu32.

Don't forget to install the GLUT devpak.

Ivan Vučica