J. H
J. H

Reputation: 196

How to link a static library in gcc with other dynamic libraries?

The static library is: /home/jonathan/Dropbox/C++/teapotgame/bin/liblua.a

The current gcc command im using is: gcc -std=c++11 -DLUA_USE_LINUX -D_REENTRANT -I/usr/include/SDL2 -lSDL2 -lSDL2_image -lGL -lGLU -lGLEW -lopenal files.o -o bin/bin

Upvotes: 0

Views: 256

Answers (1)

nucleon
nucleon

Reputation: 1158

There's no principal difference whether you link against dynamic or static libraries (besides the -l prefix and omitting the file extension for shared libs). The order of the libraries can matter though. If you have circular dependencies, you have to list the same library twice.

Upvotes: 1

Related Questions