InsertMemeNameHere
InsertMemeNameHere

Reputation: 2433

-L option not working for mingw gcc

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.

Upvotes: 0

Views: 1851

Answers (2)

anon
anon

Reputation:

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.

Upvotes: 2

Artyom
Artyom

Reputation: 31243

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

Upvotes: 1

Related Questions