boost使用笔记

平台:ubuntu12.04LTS,boost1.53

1、应该用g++编译,而不是cc,本来想亲自解释一下的,然后发现有人写过了,看这里,简单来说,cc是指向gcc的符号链接,而gcc不能处理C++的linking.所以通常编译命令就是g++  myfile.cpp -o myfile,偶尔要链接额外的库,见第2条

  还有一段觉得讲得不错(http://stackoverflow.com/questions/1516609/difference-between-cc-gcc-and-g

CC is an environment variable referring to the system's C compiler. What it points to (libraries accessible, etc) depend on platform. Often it will point to /usr/bin/cc, the actual c complier (driver). On linux platforms, CC almost always points to /usr/bin/gcc.

gcc is the driver binary for the GNU compiler collection. It can compile C, C++, and possibly other languages; it determines the language by the file extension.

g++ is a driver binary like gcc, but with a few special options set for compiling C++. Notably (in my experience), g++ will link libstdc++ by default, while gcc won't.

2、有时会出现一大堆类似这种错误:undefined reference to boost::system::system_category()...

  对于这个,可以编译时链接boost_system库,即-lboost_system;其他的类似处理

原文地址:https://www.cnblogs.com/fstang/p/3108497.html