相关疑难解决方法(0)

什么是内联命名空间?

C++ 11允许inline namespaces,其所有成员也自动在封闭中namespace.我想不出任何有用的应用 - 有人可以给出一个简短,简洁的例子,说明inline namespace需要哪种情况以及最常用的解决方案?

(另外,当发生了什么并不清楚,我namespace声明inline在一个但不是所有的声明,这可能住在不同的文件.这难道不是找麻烦?)

c++ namespaces c++11 inline-namespaces

320
推荐指数
6
解决办法
5万
查看次数

为什么不能用c ++ 0x模式中的libc ++来链接这个boost :: program_options示例?

编译boost :: program_options的示例代码:http://svn.boost.org/svn/boost/trunk/libs/program_options/example/first.cpp

...在MacOS Lion(10.7.2)上,使用随MacPorts安装的boost-1.48.0:

$ clang++ -v
Apple clang version 3.0 (tags/Apple/clang-211.12) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix
$ clang++ -std=c++0x --stdlib=libc++ -lc++ -I/opt/local/include -L/opt/local/lib -lboost_program_options first.cpp -o first
Undefined symbols for architecture x86_64:
  "boost::program_options::options_description::options_description(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, unsigned int)", referenced from:
      _main in cc-6QQcwm.o
  "boost::program_options::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, boost::program_options::options_description const&)", referenced from:
      _main in cc-6QQcwm.o
  "boost::program_options::abstract_variables_map::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
      boost::program_options::variables_map::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in …
Run Code Online (Sandbox Code Playgroud)

c++ boost clang c++11 libc++

64
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×2

c++11 ×2

boost ×1

clang ×1

inline-namespaces ×1

libc++ ×1

namespaces ×1