Qt-对..的未定义引用(Ubuntu 14.04 LTS 64位)
Qt - undefined reference to... (Ubuntu 14.04 LTS 64 bits)
我试着用Qt5.3.1 MSVC2012编译我用windows 7 64位制作的一个项目,现在用Unbuntu 14.04 LTS编译Qt5.4 gcc 64位。
但我有一些"未定义的参考"错误:
/home/inncore/Software/CES_2015/trunk/MainProgram//bin//libSmartphoneController.a(smartphonecontroller.o):在函数
SmartphoneController::init()': /home/innocore/Software/CES_2015/trunk/bin/../LibSmartphoneController/smartphonecontroller.cpp:11: undefined reference to
中RemoteADBInterface::RemoteADBInterface(QString,QString、int、QObject*)'/home/inncore/Software/CES_2015/trunk/bin//LibSmartphoneController/smartphoneControl.cpp:13:对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,Qt::ConnectionType)':/opt/5.4/gcc_64/include/QtCore/qobject.h:239:对"RemoteADBInterface::staticMetaObject"的未定义引用collect2:错误:ld返回1退出状态
我的项目由一个exe和几个库组成,如libSmartphoneController.a或libRemoteADB.a
所有库都能正确编译,并在正确的目录中创建。当我编译我的exe程序(MainProgram)时会出现问题。在.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 Smartphone Controller还有两个依赖项:
在Smartphone Controller.pr:中
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lRemoteADB -lRemoteServer
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lRemoteADB -lRemoteServer
} }
问题是它在库RemoteADB中找不到某些函数的定义(构造函数,signal readMessage…)。我对所有其他库没有任何问题+它在windows上完美编译。。。
知道吗?
提前感谢您的帮助
我看到了问题的一个可能原因:编译器找不到库文件,你可以通过在.pro文件中添加保存库的完整路径来解决这个问题,我在这里看到的是,如果正在编译调试或发布,你有不同的搜索库的路径,你确定这两个地方都有正确的库吗?这将是一个在你的专业文件中放什么的例子:
LIBS+=-L$$OUT_PWD/../..//项目/mylibs/release/
- 将应用程序从32位移植到64位时出现问题
- 64位机器上的C++内存对齐
- qmake:检测目标位宽(32 位或 64 位)
- 如何在 64 位 vb.net Windows 应用程序中引用 32 位 dll
- Qt 5.11.2 (Clang 8.0 (Apple), 64 位), 找不到 QJSEngine 文件
- 在 64 位边界上对齐C++结构数组?
- 如何为字符串生成唯一但一致的 N 位哈希(小于 64 位)?
- 在 64 位的 c++ 中运行 mstest 测试
- 在两个线程上读/写 64 位,无互斥/锁定/原子
- 浮点数为 32 位和 64 位二进制表示形式
- 是否有 64 位等效于 GetLastInputInfo / LASTINPUTINFO?
- 所有可能的链接生成器与64位密钥
- WinAPI C++如何从 64 位应用程序加载资源
- 在 c++ 中输出 64 位整数
- 使用192/256位整数求和无符号64位整数向量的点积的最快方法
- 如何在 64 位平台上计算 32 位哈希C++?
- 使用 SysNative 在 Visual Studio 中创建 64 位应用程序
- 在 64 位整数内旋转(90°)位矩阵(最多 8x8 位)
- 64 位进程中的 AnyCPU C# DLL 无法引用 64 位C++ DLL(给出错误:无法加载文件或程序集)
- Qt-对..的未定义引用(Ubuntu 14.04 LTS 64位)