我正在尝试在Mac上构建C/C++ project。不幸的是,它不能与Apples gcc一起编译:
In file included from /src/connectionmanager.cpp:20:
/src/network.h:98:14: error: implicit instantiation of undefined
template 'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'
std::string connectToIp;
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
class _LIBCPP_TEMPLATE_VIS basic_string;
^
1 error generated.
make[2]: *** [CMakeFiles/maxr.dir/src/connectionmanager.cpp.o] Error 1
make[1]: *** [CMakeFiles/maxr.dir/all] Error 2
make: *** [all] Error 2
使用GNU gcc版本9.1.0时,所有源文件都可以毫无问题地进行编译,但是不幸的是,Apples链接器无法将其链接。
Apple gcc是否有一些兼容性标志,以使其接受GNU gcc编译时没有问题的代码?
这是Apple gcc版本:
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin