ld: symbol(s) not found for architecture x86_64错误处理

std::__1::allocator >, std::__1::allocator, std::__1::allocator > > >, char [3]>(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, char const (&) [3]) in main.o

      ...

ld: symbol(s) not found for architecture x86_64

clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)


出错信息如上所示,刚开始以为是动态库路径不对,仔细看了出错信息才知道是没找到合适的标准库std::,所以才会报出一堆关于std的错误信息。根本原因是makefile中写的是CLANG_COMP = /usr/local/opt/llvm/bin/clang,c++ standard library的项,其默认值是libc++,经搜索得知这是一个苹果新写的c++标准库,用来支持最新的c++11标准。于是知道这是两端库不统一的问题。于是改为CLANG_COMP = /usr/local/opt/llvm/bin/clang++,搞定!

你可能感兴趣的:(编程语言)