tags:

views:

38

answers:

2

I am trying to get mingw gcc to work.

I need it to link with libopengl32.a.

Said file exists in C:/mingw/lib.

I used g++ as follows:

g++ -L"C:/mingw/lib" main.o -o test.exe -llibopengl32.a

It has no trouble finding the includes, it just complains that it can't find the library.

It seems unable to find any other library as well.

Also: I installed all the mingw components manually by downloading them from sourceforge, since using the automatic installer produced a broken installation on my system.

+1  A: 

You need to use -lopengl32 without "lib" and ".a"

Artyom
Thanks!It worked.
i_photon
+2  A: 

The -l flag automatically adds the lib prefix and the .a extension- you want:

g++ -LC:/mingw/lib main.o -o test.exe -lopengl32

Note you don't need the quotes around the path either. You could also just specify the whole library name & path:

g++  main.o -o test.exe C:/mingw/lib/libopengl32.a

As regards your installation problems, use either http://tdragon.net/recentgcc/ or http://nuwen.net/mingw.html - using the MinGW site itself is a recipe for pain.

anon
And much pain it was indeed.I've marked this as the answer as it is more informative.Thanks for the links!
i_photon