Lara
Lara

Reputation: 3174

ld.exe cannot find -lGL

I have recently bought a book on OpenGL and am trying to follow the examples, but I can't get to seem OpenGL to work.

For example, it gives me the error:

ld.exe||cannot find -lGL|.

My compiler is GNU-GCC MinGW on with the IDE Code::Blocks, and my OS is Windows 7 64 bit. I have linked the libraries: opengl32, glu32, glut32, and in other linker options I have: -lmingw32 -lSDLmain -lSDL, because this was advised on the code::blocks wiki.

I have some experience with C++, but not at all when it comes to linking, and setting up the compiler, because this used to go quite automatic.

How do I fix this error?

Upvotes: 3

Views: 7731

Answers (3)

user3017702
user3017702

Reputation: 1

It's probably due to the library and include folder permission set to read-only, I am currently having the same issues but i am working with my SFML compilation, I solved it by setting the linker to the exact lib file not the folder, you may try the same solution

Upvotes: 0

datenwolf
datenwolf

Reputation: 162317

-lGL is the linkage option used on *nix systems. On Windows you should use -lopengl32

Upvotes: 4

bames53
bames53

Reputation: 88215

The flag -lGL is to link to the opengl library, but on Windows the opengl library is called opengl32, not libgl. So you shouldn't use -lGL and if you're already linking in opengl32 then that should be all you need.

Upvotes: 5

Related Questions