gcc 5.2.1 _GLIBCXX_USE_CXX11_ABI
gcc 5.2.1 _GLIBCXX_USE_CXX11_ABI
EDIT:我使用的是gcc 5.2.1,所以很明显,现在默认情况下选择了库-一个新的libstdc++库ABI。当我试图编译我的代码:时,这可能是导致此错误消息的问题(与std::__cxx11有关)
/tmp/ccVIU5fG.o: In function `main':
2D_interpolations.cc:(.text+0x76): undefined reference to `mio::Config::Config(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
2D_interpolations.cc:(.text+0x151): undefined reference to `mio::IOUtils::convertString(mio::Date&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double const&, std::ios_base& (*)(std::ios_base&))'
我尝试在.cc文件的开头添加以下行
#define _GLIBCXX_USE_CXX11_ABI 0
然后我就可以编译了。但我遇到了一个与未定义符号有关的错误。通过使用
c++filt <the undefined symbol>
事实证明,在添加#define _GLIBCXX_USE_CXX11_ABI 0之前,未定义的符号实际上与我得到错误的位置完全相同
mio::Config::Config(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
通过检查是否存在其他未定义的符号,我认为其中也缺少一个(也在以前的错误中)
mio::IOUtils::convertString(mio::Date&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double const&, std::ios_base& (*)(std::ios_base&))
我知道已经有一些类似的帖子了,但答案对我来说太"理论化"了,因为我是c++的新手,而且我对计算机一无所知。。。如果你有任何可以帮助的建议,欢迎你!
谢谢!
我终于解决了所有问题,所以我在这里发布了解决方案,以防感兴趣
为了检查我的代码使用了哪些库,我使用了命令
ldd -r -d <name of my code file>
通过路径正确检测到使用的第三方lib Im
/usr/local/lib/<name of the library file>
但这显然不是一条好路(不要问我为什么),即使被认可。一个好的选择是将库文件更改到另一个位置:
/usr/lib/<name of the library file>
它现在工作得很完美!
相关文章:
- 如何处理 c++ 中类实现中的"invalid use of non-static data member"?
- C++ "error: invalid use of void expression"
- 我看到"use of undeclared identifier"错误,有人可以告诉我如何解决它吗?
- 链接器错误:未定义对"Reference_Genome::seq[abi:cxx11]"的引用
- 收到错误"invalid use of non-static data member 'stu::n' "
- 模式"allocate memory or use existing data"
- C++ "error: use of overloaded operator '*' is ambiguous"似乎只有一场比赛
- Is it good to use SDL_PIXELFORMAT_UNKNOWN?
- C++ "Invalid use of 'this' in non-member function" ,
- std::launder use cases in C++20
- 继承类时"invalid use of incomplete type ‘class tree_node_t’"
- 在使用 GCC 4.8.5 构建的应用中对 cxx11 函数的未定义引用
- "reserved for any use"的含义是什么?
- C++14 遇到奇怪的"use of deleted function"错误
- C++ 中的 use 函数是什么?
- 出现这种错误的原因是什么"invalid use of non-static data member "
- 如何在红帽上强制使用 cxx11 ABI?
- 模板类和'invalid use of incomplete type'错误
- 为什么"non-standard syntax; use '&' to create a pointer to member"在 CTOR 中使用线程?
- "invalid use of incomplete type" .解决循环依赖关系