Farnk
Farnk

Reputation: 244

Why doesn't my lib search path work with gcc and MinGW

I am trying to compile a sample using gcc under MinGW in windows 7

Why does this work:

$ gcc -m32 -o cube.exe cube.o shader.o matrix.o window.o 
/c/dev/mixed/SDKs/Extracted/OpenGLESEmulatorv1.3.0/examples/OpenGLES_20/cube/libEGL.lib

But this doesn't:

$ gcc -m32 -o cube.exe cube.o shader.o matrix.o window.o
-L/c/dev/mixed/SDKs/Extracted/OpenGLESEmulatorv1.3.0/examples/OpenGLES_20/cube 
-llibEGL.lib

It fails with:

c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: cannot find -llibEGL.lib
collect2.exe: error: ld returned 1 exit status

Shouldn't the -L add the correct search path?

Upvotes: 0

Views: 1074

Answers (1)

Farnk
Farnk

Reputation: 244

Per the MinGW documentation the -l argument adds lib to the front and .a to the end OR just adds .lib to the end. Removing the .lib from the end allows this to compile.

Upvotes: 2

Related Questions