Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I've searched but cannot find any description for -Wl and -rpath. And why not use those flags with g++?
Also why \
QMAKE_LFLAGS += -g -Wl,-rpath,\\\$\$ORIGIN/liblinux/
ZapB last edited by
The -Wl,-rpath part just tells the compiler to pass through the option "-rpath" to the linker.
Thanks, now how to set $ORIGIN? Compilation is at a different location than execution. But it's always in a folder in same directory as the exeutable. ( ./liblinux/libtoinclude.so )
alexisdm last edited by
$ORIGIN always represents the directory of the executable. But it doesn't limit you to directory inside the executable directory: you can use, for example, "$ORIGIN/../lib" to put your libraries in a lib directory at the same level as you executable folder:
-- myexecutable-- lib
If the path you want to add is absolute, don't use $ORIGIN, start your path with / (or you could rely on /etc/ld.so.conf to find the correct installed libraries in the default system paths).
Thanks now I get a dlerror. Are my includes wrong or how to use the lib without linking? (the lib is GPL so I cannot directly link)
INCLUDEPATH += ./
QMAKE_LFLAGS += -g -Wl,-rpath,\$$ORIGIN