Q: Why can't clang with libc in C 0x mode link this boost::program_options example?
The reported issue arises when attempting to compile and link a sample boost::program_options example with clang and libc in C 0x mode. The compilation succeeds, but linking encounters several undefined symbols leading to a linker error.
A: Rebuilding Boost with Clang and Libc
To resolve this issue, it is necessary to rebuild the boost libraries using clang with the libc standard library. The following steps outline the process:
./b2 toolset=clangcxx --with-libraries=program_options \ --with-cflags="-stdlib=libc++" --with-ldflags="-stdlib=libc++"
./b2 install
After rebuilding Boost with libc , recompiling and linking the boost::program_options example using clang with the libc standard library should succeed without the previously encountered undefined symbol errors.
The above is the detailed content of Why can\'t clang with libc in C 0x mode link this boost::program_options example?. For more information, please follow other related articles on the PHP Chinese website!