2015-02-06 2 views
1

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 to RemoteADBInterface::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

그건를 이상한 창문이 문제가되지 않습니다 ...

+0

때로는 순서 gcc의 라이브러리가 컴파일에 영향을줍니다. 나는 이것이 여기의 문제인지는 모르지만 다만 알고 있습니다. –

+0

흥미 롭다면 어떻게 다른 주문을 할 수 있습니까? 난 그냥 .pro 파일에서 종속성 순서를 변경해야합니까? – palador

+0

맞습니다. 그게 여기서 문제가되는지는 잘 모르겠지만, 과거에는 비슷한 문제가 있었고 명령을 변경하면 해결되었습니다. 종속성이 있기 전에 종속 라이브러리를 추가해야 할 수도 있습니다. –

답변

0

컴파일러가 라이브러리 파일을 찾지 못했고 .pro 파일에 전체 경로를 추가하여이 문제를 해결할 수 있습니다. 도서관을 구했어. 내가 여기서 볼 수있는 것은 네가 찾을 경로가 다르다는거야. h 라이브러리 디버그 또는 릴리즈를 컴파일하는 경우 두 라이브러리 모두에 올바른 라이브러리가 있습니까? 이것은 당신의 프로 파일에 어떤 내용의 예를 들면 다음과 같습니다/

LIBS + = -L $$ OUT_PWD /../../../ 프로젝트/mylibs/해제

+0

답장을 보내 주셔서 감사합니다.하지만 같은 디렉토리에 라이브러리가 더 많으며 libRemoteADB.a가이 문제를 일으키는 유일한 라이브러리 인 것 같습니다. 다른 것들은 잘 연결되어 있습니다. 어쨌든 나는 전체 경로로 시도하고 문제는 동일하게 유지되었습니다 ... – palador

+0

이 경우 라이브러리 자체에 문제가있는 것 같습니다. libSmartphonecontroller는 다른 버전의 remoteADB와 RemoteADBInterface :: newMessage를 사용하여 빌드 한 것 같습니다. (RemoteADBInterface :: Message const &, QVariant const &) '가 RemoteADB 라이브러리에 더 이상 존재하지 않습니다. – Marco

+0

실제로 문제는 MainProgram.pro 파일에 포함 된 종속성의 순서입니다 (제 편집 참조). 그래서 이제 해결되었습니다 :)! – palador

관련 문제