3

I'm trying to compile a program with GLAD and SDL2 using scons (though scons isn't really relevant since g++ is the issue)

scons runs the following command to compile part of the program:

g++ -o out/cpptest bin/src/MainTest.o bin/src/main.o -L/usr/local/lib -Lbin/lib -ldl -lm -lGL -lGLU -lX11 -lpthread -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -lglad -lSDL2 -pthread

g++ returns the following error message:

/usr/bin/ld: bin/lib/libglad.a(glad.c.o): undefined reference to symbol 
'dlclose@@GLIBC_2
.2.5'
 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libdl.so: error 
 adding symbols: DSO missing from command line
 collect2: error: ld returned 1 exit status

Some advice would be much apreciated.

Also note the following flags ARE present:

    -ldl -lm -lpthread -pthread
2

1 Answer 1

3

You simply need to add the flags "-Wl and --start-group"

for scons add LINKFLAGS=['-Wl,--start-group'].

Reference: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .