0

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?

Farnk
  • 244
  • 3
  • 12

1 Answers1

2

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.

Farnk
  • 244
  • 3
  • 12
  • Sort of, you need to remove both the `lib` from the start *and* the `.lib` from the end, like this: `-lEGL`. The compiler will add them back when it searches for the file. – ams Jun 30 '12 at 20:25