views:

208

answers:

1

Hello, I have this situation, I use Netbeans 6.8 with recommended MinGW+msys configuration, and compiling works. Now I have a project which is using glut, so I linked the libraries opengl32, glut32, glu32, gdi32, winmm, mingw32 in "project properties->build->linker->libraries", i manually selected all .lib files and the compilation works!

But, then I added some other h and cpp files to the project (texture loaders etc.), which use glut and they #include it and the IDE seems fine with it, but when I try to compile the code, errors comes up when compiling those files:

.../Terrain.cpp:132: undefined reference to `_imp__glVertex3fv'
.../Terrain.cpp:135: undefined reference to `_imp__glTexCoord2d'
.../Terrain.cpp:139: undefined reference to `_imp__glNormal3fv'
.../Terrain.cpp:140: undefined reference to `_imp__glVertex3fv'

And tons more. In my understanding this means that lib files are not linked, but they ARE linked in the project and the main file can use all these without problem.

I tried everything but I'm probably missing something. Also the project (creating new project from the files in vs2010) can be compiled using vs2010 compiler.

Please help, does anyone have expirience in linking libraries with MinGW in NetBeans?

A: 

Oh my god!! Every single file using glut.h needs to have included windows.h before including gl.h or glut.h..

Took quite some of my time, hope it helps someone (I was searching for solution here too).

Note: I found the answer here link text, in section 2.070, there is error, such as ...undefined reference to ..., described, but the windows.h solution is described in other type of error (

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : 
error C2054: expected '(' to follow 'WINGDIAPI'
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : 
error C2085: 'APIENTRY' : not in formal parameter list

)

YangombiUmpakati