PDA

View Full Version : OpenGl linking error



mounir
02-17-2017, 12:08 AM
Hi,i write a simple program under windows showing a rectangle and i compile it with MinGw using the command line (I know IDE are better but just want to do it the old way) and this is the command line:

g++ main.cpp -L"lib" -lglfw3dll -lglew32dll

but the function glDrawArrays() still undefined and i dont know what library should i link to it or what i forget ?

Silence
02-17-2017, 01:39 AM
Hi,i write a simple program under windows showing a rectangle and i compile it with MinGw using the command line (I know IDE are better but just want to do it the old way) and this is the command line:

g++ main.cpp -L"lib" -lglfw3dll -lglew32dll

but the function glDrawArrays() still undefined and i dont know what library should i link to it or what i forget ?

Try to add "-lGL" also. This is where "common" OpenGL function symbols are defined.

mounir
02-17-2017, 01:59 AM
Try to add "-lGL" also. This is where "common" OpenGL function symbols are defined.

The linker cannot find that library and i cant find it i seek my hole computer looking for libgl or something like that i just cant find it. please help it's my final step to start learn opengl? should i download it? compile it? where can i find it?

Silence
02-17-2017, 02:24 AM
The linker cannot find that library and i cant find it i seek my hole computer looking for libgl or something like that i just cant find it. please help it's my final step to start learn opengl? should i download it? compile it? where can i find it?

True. Under Windows it should be called OpenGL32.dll

mounir
02-17-2017, 03:07 AM
True. Under Windows it should be called OpenGL32.dll

Thanks For Every one efforts We resolve it and this is the command line

C:\Users\nidal\Desktop\metalslug3>g++ -o hellot.exe main.cpp -L"lib" -lglfw3dll -lglew32dll -lopengl32

OceanJeff40
02-21-2017, 09:56 PM
I always link opengl32.lib...... but then again, I'm new. Maybe there is a opengl32.dll???

Jeff

OceanJeff40
02-21-2017, 09:58 PM
Ok, yeah, I just searched, and there are two files opengl32.dll, and opengl32.lib. So one is a library file you can link to, and another is dynamic link library, you can load and call functions from.

I learned something tonight,

Jeff

OceanJeff40
02-21-2017, 09:59 PM
Just noticed, there are x64 and x86 versions of these files, with the same name. I just love Microsoft's way of doing things.

Jeff