一个简单的vector 的c++ 程序, 编译错误
#include <vector>
int main()
{
std::vector<int> vet;
}
错误原因:使用的gcc 命令(应该使用g++命令)
gcc :
“GCC” is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for “GNU C Compiler”).
使用gcc 编译c++程序,虽然gcc也能识别出c++,但gcc并不会加载c++ library
g++:
而使用g++ 编译c++程序,会调用gcc而且会自动加载c++ library
please refer:
* http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/G_002b_002b-and-GCC.html
* man g++
#include <vector>
int main()
{
std::vector<int> vet;
}
错误原因:使用的gcc 命令(应该使用g++命令)
gcc :
“GCC” is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for “GNU C Compiler”).
使用gcc 编译c++程序,虽然gcc也能识别出c++,但gcc并不会加载c++ library
g++:
而使用g++ 编译c++程序,会调用gcc而且会自动加载c++ library
please refer:
* http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/G_002b_002b-and-GCC.html
* man g++