2

Original Question:

[Warning] passing GLfloat' for converting 2 ofvoid glutSolidSphere(GLdouble, GLint, GLint)'
[Warning] passing GLfloat' for converting 3 ofvoid 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.

Community
  • 1
  • 1
noob88
  • 297
  • 2
  • 9
  • 17

5 Answers5

1

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
  • 391,730
  • 64
  • 469
  • 606
1

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
  • 37,249
  • 18
  • 95
  • 132
1

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
  • 33,368
  • 30
  • 112
  • 143
1

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
  • 9,529
  • 9
  • 60
  • 111
0

GLUTMingw32.zip file contains all files necessary to build under devcpp I extracted it on desktop . added lib and include directories from devcpp project-project options menu to include and lib directories . after added in project options dialog on parameters tab - > linker :

../../../../Dev-Cpp/lib/libopengl32.a

../../../../Dev-Cpp/lib/libglu32.a

../GLUTMingw32/GLUTMingw32/lib/libglut32.a

first two are in devcpp install dir/lib folder /you can use -lopengl32 and -lglu32 instead , it works/

third one ,libglut32.a , I added from extracted GLUTMingw32.zip folder

placed glut32.dll in folder where project got generated and main.cpp resides

thats all . after I got Permission denied I just removed generated exe file and recompiled if exe can't be deleted close devcpp

if it complains about short redefinition

add at the top of main.cpp "# define _WCHAR_T_DEFINED"

without quotes