(1) example.cpp文件
#include <iostream>
int main()
{
std::cout << "start example!" << std::endl;
char *p = nullptr;
if(p == nullptr) {
std::cout << "p is NULL" << std::endl;
}
return 0;
}
(2) 编译命令
clang++ example.cc -std=c++11 -stdlib=libc++ -o example.bin
(3) 编译错误
错误1:example.cc:1:10: fatal error: 'iostream' file not found
错误2:/usr/bin/ld: cannot find -lc++abi
(4) 解决方案
sudo apt-get install libc++-dev libc++abi-dev