Windows 7에서 만든 프로젝트 중 하나를 컴파일하려고합니다. Qt5.3.1 MSVC2012를 사용하여 64 비트를 만들고, Unbuntu에서 Qt5.4 gcc 64 비트를 사용합니다. 14.04 LTS.Qt - 정의되지 않은 참조 ... (Ubuntu 14.04 LTS 64 비트)
/home/innocore/Software/CES_2015/trunk/MainProgram/../bin//libSmartphoneController.a(smartphonecontroller.o): In function
SmartphoneController::init()': /home/innocore/Software/CES_2015/trunk/bin/../LibSmartphoneController/smartphonecontroller.cpp:11: undefined reference to
RemoteADBInterface::RemoteADBInterface(QString, QString, int, QObject*)' /home/innocore/Software/CES_2015/trunk/bin/../LibSmartphoneController/smartphonecontroller.cpp:13: undefined reference toRemoteADBInterface::newMessage(RemoteADBInterface::Message const&, QVariant const&)' /home/innocore/Software/CES_2015/trunk/MainProgram/../bin//libSmartphoneController.a(smartphonecontroller.o): In function
QMetaObject::Connection QObject::connect(QtPrivate::FunctionPointer::Object const*, void (RemoteADBInterface::)(RemoteADBInterface::Message const&, QVariant const&), QtPrivate::FunctionPointer::Object const, void (SmartphoneController::*)(RemoteADBInterface::Message const&, QVariant const&), Qt::ConnectionType)': /opt/5.4/gcc_64/include/QtCore/qobject.h:239: undefined reference to `RemoteADBInterface::staticMetaObject' collect2: error: ld returned 1 exit status
내 프로젝트가 하나의 EXE 및 libSmartphoneController.a 또는 libRemoteADB.a 같은 여러 라이브러리로 구성되어 있습니다 :
는하지만 오류가 몇 가지 "에 대한 정의되지 않은 참조"를 가지고있다.
모든 라이브러리가 올바르게 컴파일되고 올바른 디렉토리에 만들어집니다. 문제는 내 exe 프로그램 (MainProgram)을 컴파일 할 때 발생합니다. 문제는
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lRemoteADB -lRemoteServer
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lRemoteADB -lRemoteServer
} }
: SmartphoneController.pro에서
:
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lAudioPlayer -lDisplay -lSWCom -lRemoteADB -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lAudioPlayer -lDisplay -lSWCom -lRemoteADB -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer
} }
lib 디렉토리 SmartphoneController는 두 종속성이 다음 .PRO에서 , 내가 올바른 종속 관계를 포함 확신 그것은 lib RemoteADB (contructor, signal readMessage ...)에서 일부 함수의 정의를 찾지 못한다는 것입니다. 나는 다른 모든 libs + 윈도우에서 완벽하게 컴파일하는 데 어떤 문제가 없습니다 ...
어떤 생각? 당신의 도움에 미리
감사
편집 : purplehuman에 문제 해결 감사합니다. 이는 MainProgram의 .pro 파일에있는 종속성의 순서 때문이었습니다.
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lAudioPlayer -lDisplay -lSWCom -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer -lRemoteADB
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lAudioPlayer -lDisplay -lSWCom -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer -lRemoteADB #remoteADB has to be AFTER smartphonecontroller
} }
SmartphoneController는 RemoteADB 및 RemoteServer에의 의존과 .PRO 파일에서,이 순서에 종속 넣어 그래서 메인 프로 그램은 SmartphoneController의 따라 달라집니다 : 1) SmartphoneController 2)은 RemoteServer와 RemoteADB
그건를 이상한 창문이 문제가되지 않습니다 ...
때로는 순서 gcc의 라이브러리가 컴파일에 영향을줍니다. 나는 이것이 여기의 문제인지는 모르지만 다만 알고 있습니다. –
흥미 롭다면 어떻게 다른 주문을 할 수 있습니까? 난 그냥 .pro 파일에서 종속성 순서를 변경해야합니까? – palador
맞습니다. 그게 여기서 문제가되는지는 잘 모르겠지만, 과거에는 비슷한 문제가 있었고 명령을 변경하면 해결되었습니다. 종속성이 있기 전에 종속 라이브러리를 추가해야 할 수도 있습니다. –