未定义的引用提升::p rogram_options::abstract_variables_map::operator
undefined reference boost::program_options::abstract_variables_map::operator[]
当我使用以下命令将program_options链接到我的共享库时:
g++ -L/path_to_static_boost_libs -shared -o "test.so" ./test.o -lboost_program_options
由于 abstract_variables_map::operator[] 上未定义的引用,我无法加载库:
0009b9f8 W int const& boost::program_options::variable_value::as<int>() const
U boost::program_options::abstract_variables_map::operator[](std::string const&) const
0009b55e W boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> >::clone() const
我尝试构建另一个程序(不是共享库),其中program_options库静态链接,并且没有得到未定义的引用。
为什么我在链接共享库时得到未定义的引用?
第 1 步:找出未解析符号的损坏名称(应该已经显示在dlerror()
错误消息中)。
第 2 步:找出哪个提升库为该符号提供了定义:
nm -A /path_to_static_boost_libs/*.a | grep <mangled-symbol-name>
第 3 步:将该库添加到 test.so
的链接行。
第四步:利润。
相关文章:
- 如何理解"abstract-declarator containing an ellipsis shall only be used in a parameter-declaration"
- C++ "'Shape': cannot instantiate abstract class"找不到问题的根源
- 让编译器告诉哪些方法不具体,而不是错误'invalid new-expression of abstract class type'
- 如何将 Python 脚本通过管道传输到命令(boost::p rogram::options)
- CRTP - 静态接口中的"abstract"方法
- "Allocating an object of abstract class type"错误,尽管所有函数都有实现
- Msbuild and ClCompile options
- IDL 接口,C++,CORBA,我正在处理"conflicting return type specified for"和"invalid abstract return type for memb
- 我们可以通过在C++中的类中使用关键字“abstract”使所有方法抽象来声明接口类吗
- Regex options for std::regex
- 抽象类和虚方法问题:"cannot allocate an object of abstract type"
- 设计模式?如何做"Abstract generator creating abstract instance"
- Netbeans :在编译命令末尾添加"Compile Line - Additional Options" "-lboost_system"
- C++ Eigen: 'Options' : 不是'Eigen::MatrixBase<Derived>'的成员
- 在装有 GCC 4.8 的 Mac 上"error: too many #pragma options align=reset"
- 简洁的"this class overrides all necessary methods to be non-abstract"
- boost 如何将类型列表实现为类的"options"?
- 'Cannot instantiate abstract class'虽然类不应该是抽象的
- visual studio 2013 options
- 在类名后使用 MSVCC 扩展关键字"abstract"是一种好的做法吗?