体系结构x86_64的未定义符号:
Undefined symbols for architecture x86_64:
接口:
class rmKeyControl {
static map<char, function<char(char)>> sm_function_list;
public:
static bool addKeyAction(char, function<char(char)>);
};
实现:
bool rmKeyControl::addKeyAction(char key, function<char(char)> func) {
if (!sm_function_list.count(key)) {
sm_function_list.insert(pair<char, function<char(char)>>(key, func));
return true;
} return false;
}
完整的错误消息是:
体系结构x86_64的未定义符号:"control::rmKeyControl::sm_function_list",引用自:control::rmKeyControl::addKeyAction(char,std::__1::function)在rm_KeyControl.o中ld:找不到体系结构x86_64的符号clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
这似乎是Xcode 4的标准链接器错误,但它似乎是由于各种原因而发生的,而且从未详细说明。这个错误似乎表明存在在x86_64体系结构上不起作用的二进制指令,但在这种情况下没有意义。为什么我会出现此错误?
编辑:我忘了提到rmKeyControl
在名称空间control
中。我是实现中的using namespace control;
,尽管您看不到它。
静态成员只是声明。在实现/源文件中定义它,如-
// include interface header and then do -
map<char, function<char(char)>> rmKeyControl::sm_function_list;
相关文章:
- vscode g++链路故障:体系结构x86_64的未定义符号
- 体系结构x86_64的未定义符号:std:terminate(),typeinfo,运算符delete[],运算符new
- C++ 中 dlsym 的未定义符号
- 仅在 MacOS 上析构函数的未定义符号
- OSX clang++:用于 cpp 文件中显式实例化模板的体系结构x86_64的未定义符号
- PCL 出错:体系结构x86_64 @pcl的未定义符号
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 体系结构x86_64的未定义符号:链接器错误
- C++ std::vector<int> 体系结构的未定义符号 x86_64:
- 生成文件:体系结构x86_64的未定义符号
- libc++abi未定义符号:_ZTVN10__cxxabif120__si-class_type_infoE
- Xcode"体系结构x86_64的未定义符号"
- 体系结构x86_64的未定义符号:找不到原因
- SWIG链接器:未定义符号:_ZN2cv8fastFreeEPv(cv::fastFree(void*))
- 如何修复架构x86_64的未定义符号,Boost Asio 1.58
- 在Qt5上去静态库:架构的未定义符号x86_64:
- 体系结构x86_64的未定义符号:c++/ h 文件和 cpp 文件
- 监视 SDK 下的未定义符号"__Unwind_SjLj_Unregister"
- 使用 Boost/Python 的未定义符号 - 复杂
- 建筑x86_64的未定义符号:"vtkDebugLeaksManager::vtkDebugLeaksManager()",引用自: