g++ fails with an undefined reference to symbol 'dlclose@@GLIBC_2.2.5' even with '-ldl'
13,904
You simply need to add the flags "-Wl and --start-group"
for scons add LINKFLAGS=['-Wl,--start-group'].
Related videos on Youtube
Author by
codedcosmos
Updated on September 18, 2022Comments
-
codedcosmos over 1 year
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
-
steeldriver over 5 yearsIt may be a matter of the order in which you have specified the libraries - see for example Why does the order in which libraries are linked sometimes cause errors in GCC?
-
Mostafa Najafiyazdi almost 4 yearsDo you have libglad.a in the path shown
bin/lib/libglad.a
?
-