qt compile error: symbol(s) not found for architecture x86_64
qt compile error: symbol(s) not found for architecture x86_64
正在尝试使用 Qt 5.4 clang 64 位在 mac 上编译程序。该程序包括使用 Opal Kelly .dylib 文件和头文件与通过 USB 连接的 FPGA 通信。该程序在 windows 上使用 windows 版本的 .dylib (.dll) 和 windows 头文件编译得很好,但是在 mac 上我在尝试编译时遇到以下错误:
:-1: error: symbol(s) not found for architecture x86_64
编译器输出为:
Undefined symbols for architecture x86_64:
"_okFrontPanelDLL_LoadLib", referenced from:
MainWindow::AllocateMemory() in ProcessingFunctions.o
"_okFrontPanelManager_Destruct", referenced from:
OpalKelly::FrontPanelManager::~FrontPanelManager() in main.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in fpga.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in graphing.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in FPGAScanner.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in ProcessingFunctions.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in mainwindow.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in moc_mainwindow.o
...
"_okFrontPanel_ConfigureFPGA", referenced from:
OpalKellyLegacy::okCFrontPanel::ConfigureFPGA(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mainwindow.o
"_okFrontPanel_Construct", referenced from:
OpalKellyLegacy::okCFrontPanel::okCFrontPanel() in ProcessingFunctions.o
"_okFrontPanel_Destruct", referenced from:
OpalKellyLegacy::okCFrontPanel::~okCFrontPanel() in mainwindow.o
"_okFrontPanel_GetDeviceCount", referenced from:
OpalKellyLegacy::okCFrontPanel::GetDeviceCount() in ProcessingFunctions.o
"_okFrontPanel_GetDeviceID", referenced from:
OpalKellyLegacy::okCFrontPanel::GetDeviceID() in ProcessingFunctions.o
"_okFrontPanel_GetSerialNumber", referenced from:
OpalKellyLegacy::okCFrontPanel::GetSerialNumber() in ProcessingFunctions.o
"_okFrontPanel_GetWireOutValue", referenced from:
OpalKellyLegacy::okCFrontPanel::GetWireOutValue(int) in FPGAScanner.o
"_okFrontPanel_IsFrontPanelEnabled", referenced from:
OpalKellyLegacy::okCFrontPanel::IsFrontPanelEnabled() in ProcessingFunctions.o
"_okFrontPanel_LoadDefaultPLLConfiguration", referenced from:
OpalKellyLegacy::okCFrontPanel::LoadDefaultPLLConfiguration() in mainwindow.o
"_okFrontPanel_OpenBySerial", referenced from:
OpalKellyLegacy::okCFrontPanel::OpenBySerial(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ProcessingFunctions.o
"_okFrontPanel_ReadFromPipeOut", referenced from:
OpalKellyLegacy::okCFrontPanel::ReadFromPipeOut(int, long, unsigned char*) in FPGAScanner.o
"_okFrontPanel_SetWireInValue", referenced from:
OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in fpga.o
OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in FPGAScanner.o
"_okFrontPanel_UpdateWireIns", referenced from:
OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in fpga.o
OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in FPGAScanner.o
"_okFrontPanel_UpdateWireOuts", referenced from:
OpalKellyLegacy::okCFrontPanel::UpdateWireOuts() in FPGAScanner.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [AFE-MP-512.app/Contents/MacOS/AFE-MP-512] Error 1
13:38:18: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project AFE (kit: Clone of Desktop Qt 5.4.0 clang 32bit)
When executing step "Make"
13:38:18: Elapsed time: 00:31.
我知道当头文件中有 SLOT 或函数未被使用时会发生这种错误,但是我不知道如何找到导致问题的原因。
Opal Kelly 头文件位于 here。
非常感谢任何帮助,如果您需要更多信息,请告诉我!
表示存在以下问题:
- 当你应该 link 64 位
时,你正在 link 32 位 dylib
- 链接器找不到库
- 或者库中不存在所需的符号。
您可以查看编译器和 linker 选项以确保正在 linked 库。使用 nm
或 string
确保库中存在函数。
The program includes using Opal Kelly .dylib files and header files to talk to an FPGA connected through USB....
Undefined symbol for std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
...
__1
表示您正在使用 LLVM C++ 运行时 (libc++
)。在某个地方,您可能正在混合和匹配 GNU C++ 运行时 (libstdc++
)。 GNU C++ 运行时 (libstdc++
) 缺少 符号中的 __1
。
您应该检查项目 和 所有预构建的库,并确保它们正在使用一个或另一个。对于每个,您应该使用 (1) -stdlib=libc++
(LLVM) 或 (2) -stdlib=libstdc++
(GNU) 中的 CXXFLAGS
。
请注意,像 Xcode 这样的 IDE 可能使用与像 Opal Kelly 这样的库不同的 -stdlib=...
设置。在这种情况下,让 Xcode 匹配 Opal Kelly 库,或重建 Opal Kelly 库以匹配 Xcode.
如果有兴趣,__1
是用于版本控制的内联命名空间。参见 What are inline namespaces for? and 。
iphonesimulator:
CONFIG(iphonesimulator, iphoneos | iphonesimulator)
QMAKE_APPLE_SIMULATOR_ARCHS = x86_64 #i386 for 32bit
iphoneos:
CONFIG(iphoneos, iphoneos | iphonesimulator)
正在尝试使用 Qt 5.4 clang 64 位在 mac 上编译程序。该程序包括使用 Opal Kelly .dylib 文件和头文件与通过 USB 连接的 FPGA 通信。该程序在 windows 上使用 windows 版本的 .dylib (.dll) 和 windows 头文件编译得很好,但是在 mac 上我在尝试编译时遇到以下错误:
:-1: error: symbol(s) not found for architecture x86_64
编译器输出为:
Undefined symbols for architecture x86_64:
"_okFrontPanelDLL_LoadLib", referenced from:
MainWindow::AllocateMemory() in ProcessingFunctions.o
"_okFrontPanelManager_Destruct", referenced from:
OpalKelly::FrontPanelManager::~FrontPanelManager() in main.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in fpga.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in graphing.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in FPGAScanner.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in ProcessingFunctions.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in mainwindow.o
OpalKelly::FrontPanelManager::~FrontPanelManager() in moc_mainwindow.o
...
"_okFrontPanel_ConfigureFPGA", referenced from:
OpalKellyLegacy::okCFrontPanel::ConfigureFPGA(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mainwindow.o
"_okFrontPanel_Construct", referenced from:
OpalKellyLegacy::okCFrontPanel::okCFrontPanel() in ProcessingFunctions.o
"_okFrontPanel_Destruct", referenced from:
OpalKellyLegacy::okCFrontPanel::~okCFrontPanel() in mainwindow.o
"_okFrontPanel_GetDeviceCount", referenced from:
OpalKellyLegacy::okCFrontPanel::GetDeviceCount() in ProcessingFunctions.o
"_okFrontPanel_GetDeviceID", referenced from:
OpalKellyLegacy::okCFrontPanel::GetDeviceID() in ProcessingFunctions.o
"_okFrontPanel_GetSerialNumber", referenced from:
OpalKellyLegacy::okCFrontPanel::GetSerialNumber() in ProcessingFunctions.o
"_okFrontPanel_GetWireOutValue", referenced from:
OpalKellyLegacy::okCFrontPanel::GetWireOutValue(int) in FPGAScanner.o
"_okFrontPanel_IsFrontPanelEnabled", referenced from:
OpalKellyLegacy::okCFrontPanel::IsFrontPanelEnabled() in ProcessingFunctions.o
"_okFrontPanel_LoadDefaultPLLConfiguration", referenced from:
OpalKellyLegacy::okCFrontPanel::LoadDefaultPLLConfiguration() in mainwindow.o
"_okFrontPanel_OpenBySerial", referenced from:
OpalKellyLegacy::okCFrontPanel::OpenBySerial(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ProcessingFunctions.o
"_okFrontPanel_ReadFromPipeOut", referenced from:
OpalKellyLegacy::okCFrontPanel::ReadFromPipeOut(int, long, unsigned char*) in FPGAScanner.o
"_okFrontPanel_SetWireInValue", referenced from:
OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in fpga.o
OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in FPGAScanner.o
"_okFrontPanel_UpdateWireIns", referenced from:
OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in fpga.o
OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in FPGAScanner.o
"_okFrontPanel_UpdateWireOuts", referenced from:
OpalKellyLegacy::okCFrontPanel::UpdateWireOuts() in FPGAScanner.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [AFE-MP-512.app/Contents/MacOS/AFE-MP-512] Error 1
13:38:18: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project AFE (kit: Clone of Desktop Qt 5.4.0 clang 32bit)
When executing step "Make"
13:38:18: Elapsed time: 00:31.
我知道当头文件中有 SLOT 或函数未被使用时会发生这种错误,但是我不知道如何找到导致问题的原因。
Opal Kelly 头文件位于 here。
非常感谢任何帮助,如果您需要更多信息,请告诉我!
表示存在以下问题:
- 当你应该 link 64 位 时,你正在 link 32 位 dylib
- 链接器找不到库
- 或者库中不存在所需的符号。
您可以查看编译器和 linker 选项以确保正在 linked 库。使用 nm
或 string
确保库中存在函数。
The program includes using Opal Kelly .dylib files and header files to talk to an FPGA connected through USB.... Undefined symbol for
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
...
__1
表示您正在使用 LLVM C++ 运行时 (libc++
)。在某个地方,您可能正在混合和匹配 GNU C++ 运行时 (libstdc++
)。 GNU C++ 运行时 (libstdc++
) 缺少 符号中的 __1
。
您应该检查项目 和 所有预构建的库,并确保它们正在使用一个或另一个。对于每个,您应该使用 (1) -stdlib=libc++
(LLVM) 或 (2) -stdlib=libstdc++
(GNU) 中的 CXXFLAGS
。
请注意,像 Xcode 这样的 IDE 可能使用与像 Opal Kelly 这样的库不同的 -stdlib=...
设置。在这种情况下,让 Xcode 匹配 Opal Kelly 库,或重建 Opal Kelly 库以匹配 Xcode.
如果有兴趣,__1
是用于版本控制的内联命名空间。参见 What are inline namespaces for? and
iphonesimulator:
CONFIG(iphonesimulator, iphoneos | iphonesimulator)
QMAKE_APPLE_SIMULATOR_ARCHS = x86_64 #i386 for 32bit
iphoneos:
CONFIG(iphoneos, iphoneos | iphonesimulator)