我在Qt Creator中构建一个项目时收到错误消息,我怀疑它有与g ++链接的东西。 更具体地说,我认为它与为g ++编译器提供参数的顺序有关。
我确实阅读了g ++的手册页,但我找不到任何错误。
这是build -...目录中运行make的输出
cd framework/ && ( test -e Makefile || /home/<user>/qt-versions/5.7/gcc_64
/bin/qmake /home/<user>/workspace/Ubuntu-SDK/<project>/framework/framework.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug CONFIG+=DESKTOP -o Makefile ) && make -f Makefile
make[1]: Entering directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/framework'
make[1]: Nothing to be done for 'first'.
make[1]: Leaving directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/framework'
cd qmapboxgl/ && ( test -e Makefile || /home/<user>/qt-versions/5.7/gcc_64/bin/qmake /home/<user>/workspace/Ubuntu-SDK/<project>/qmapboxgl/qmapboxgl.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug CONFIG+=DESKTOP -o Makefile ) && make -f Makefile
make[1]: Entering directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/qmapboxgl'
Makefile:10851: warning: overriding recipe for target 'install_target'
Makefile:10836: warning: ignoring old recipe for target 'install_target'
Makefile:10858: warning: overriding recipe for target 'uninstall_target'
Makefile:10843: warning: ignoring old recipe for target 'uninstall_target'
make[1]: Nothing to be done for 'first'.
make[1]: Leaving directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/qmapboxgl'
cd <application>/ && ( test -e Makefile || /home/<user>/qt-versions/5.7/gcc_64/bin/qmake /home/<user>/workspace/Ubuntu-SDK/<project>/<application>/<application>.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug CONFIG+=DESKTOP -o Makefile ) && make -f Makefile
make[1]: Entering directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>'
Makefile:12218: warning: overriding recipe for target 'install_target'
Makefile:12209: warning: ignoring old recipe for target 'install_target'
Makefile:12222: warning: overriding recipe for target 'uninstall_target'
Makefile:12213: warning: ignoring old recipe for target 'uninstall_target'
g++ -Wl,-rpath,/home/<user>/qt-versions/5.7/gcc_64/lib -Wl,-rpath-link,/home/<user>/qt-versions/5.7/gcc_64/lib -o <application> main.o textfile.o logfilehandler.o gps.o transceiver.o transceiverresult.o transceiverstatus.o transceiverstatusresult.o osinfo.o mainwindow.o PlotterQml.o qcustomplot.o RealTimePlotter.o jswrapper.o jswrappernullobject.o timestampreader.o axesbuilder.o datematcher.o graphbuilder.o inputdatasetup.o plotter.o questionnaireloader.o userprofiletransceiver.o surveyhandler.o questionnaire.o question.o gpstracker.o questionslistmodel.o osutils.o graphicalsettings.o statemachineruleset.o statemachinerule.o statemachine.o statemachinestate.o statemachinetrigger.o statemachinetriggerset.o pedometer.o activitymanager.o qrc_application.o moc_textfile.o moc_logfilehandler.o moc_gps.o moc_transceiver.o moc_transceiverresult.o moc_transceiverstatus.o moc_transceiverstatusresult.o moc_osinfo.o moc_mainwindow.o moc_PlotterQml.o moc_qcustomplot.o moc_RealTimePlotter.o moc_jswrapper.o moc_axesbuilder.o moc_graphbuilder.o moc_inputdatasetup.o moc_plotter.o moc_questionnaireloader.o moc_userprofiletransceiver.o moc_surveyhandler.o moc_questionnaire.o moc_question.o moc_gpstracker.o moc_questionslistmodel.o moc_osutils.o moc_graphicalsettings.o moc_statemachineruleset.o moc_statemachinerule.o moc_statemachine.o moc_statemachinestate.o moc_statemachinetrigger.o moc_statemachinetriggerset.o moc_pedometer.o moc_activitymanager.o -L/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../framework -lframework -L/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl -lqmapboxgl -ldl -L/home/<user>/qt-versions/5.7/gcc_64/lib -lQt5Location -L/usr/lib64 -lQt5Quick -lQt5Svg -lQt5MultimediaWidgets -lQt5Widgets -lQt5Multimedia -lQt5Gui -lQt5Qml -lQt5Network -lQt5Xml -lQt5Sensors -lQt5Positioning -lQt5Core -lGL -lpthread
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::decodeJPEG(unsigned char const*, unsigned long)'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::decodeWebP(unsigned char const*, unsigned long)'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `qInitResources_qmapbox()'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::Log::platformRecord(mbgl::EventSeverity, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::DefaultFileSource::DefaultFileSource(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::DefaultFileSource::setAccessToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>/../qmapboxgl/libqmapboxgl.so: undefined reference to `mbgl::platform::getCurrentThreadName[abi:cxx11]()'
collect2: error: ld returned 1 exit status
Makefile:443: recipe for target '<application>' failed
make[1]: *** [<application>] Error 1
make[1]: Leaving directory '/home/<user>/workspace/Ubuntu-SDK/build-<project>-Desktop_5_7-Debug/<application>'
Makefile:130: recipe for target 'sub-<application>-make_first-ordered' failed
make: *** [sub-<application>-make_first-ordered] Error 2
这是库中失败的.pro文件
的行TARGET = qmapboxgl
TEMPLATE = lib
DEFINES += QMAPBOXGL_LIBRARY
unix {
target.path = /usr/lib
INSTALLS += target
}
# Installation
headers.files = $$INSTALL_HEADERS
headers.path = $$PREFIX/include/qmapboxgl
target.path = $$PREFIX/$$LIBDIR
INSTALLS += headers target
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_CFLAGS = -DQMAPBOXGL_SHARED
unix:QMAKE_CLEAN += -r pkgconfig lib$${TARGET}.prl
include(qmapboxgl.pri)
以下是我如何将其添加到项目中
INCLUDEPATH += $$PWD/qmapboxgl
DEPENDPATH += $$PWD/qmapboxgl
LIBS += -L$$OUT_PWD/../qmapboxgl -lqmapboxgl
我找不到任何与我遇到的问题相符的问题。
最诚挚的问候 / Rasmus