Using qscintilla2_qt5 suddenly occurs undefined reference.
-
using Qt-creator of Qt 5.12 On Linux, The qscintilla2 library is from the Linux repo.
The error occurs when
- I installed Qt 5.13, trying to use a different Qt version, but build fail with undefined reference to Qscintilla::xxxx.
- I change back to Qt 5.12 and also different Qt-creator in the pack, build fail.
- I ensure that the source code is clean with the help of git, the build directory is deleted, the QScintilla2 lib & dev is reinstalled. build fail still. It doesn't make sense. I even tried reboot.
- I check the Internet, add one line in the .pro file:
LIB + -lqscintilla2_qt5
, it worked. build success.
But It's said that
QMAKE_LFLAGS += -lqscintilla2_qt5
is the same asLIBS += -lqscintilla2_qt5
, with the former line, build fail, with the latter line, build success. Why? -
@Gerald-L said in Using qscintilla2_qt5 suddenly occurs undefined reference.:
But It's said that QMAKE_LFLAGS += -lqscintilla2_qt5 is the same as LIB + -lqscintilla2_qt5
Where?
https://doc.qt.io/qt-5/qmake-variable-reference.html#libs is the correct way to link libraries with qmake -
@jsulm So the general way to use lib is :
- use
INCLUDEPATH +=
to specify the path of library header filess.(which can be installed byapt-get install libxxx-dev
on Linux) - use
LIBS +=
to specify the binary lib file.
But, when I use boost on Linux( which is installed from Linux repo, not manually), I didn't add any line in .pro file, just use
#include <boost/xxx>
in source file, it build ok and works fine, just like the way I use std.
Is there any system paths that qmake automaticaly checks when it makes the build, and on these occassions we don't need to add the lib and lib headers manually ? Or, even it builds OK, it's not the recommend way, just build ok by accident? - use
-
@Gerald-L Part of Boost is header only (without library files), for these parts you do not have to add anything to LIBS. Also there are system wide directories containing header files and libraries which you do not have to specify (/usr/include, /usr/lib).