C/C++ gcc g++编译的区别

来源:互联网 发布:网络布线报价表 编辑:程序博客网 时间:2024/06/06 01:25


//----------------------------------------------------

//AUTHOR: lanyang123456

//DATE: 2014-10-21

//----------------------------------------------------




/*compiler_testgcc and g++*/#include <iostream>#include <stdio.h>int main(){printf("hello\n");}/*$ gcc -o test compiler_test.cpp/tmp/cc4Xz5MO.o: In function `__static_initialization_and_destruction_0(int, int)':compiler_test.cpp:(.text+0x38): undefined reference to `std::ios_base::Init::Init()'compiler_test.cpp:(.text+0x47): undefined reference to `std::ios_base::Init::~Init()'collect2: error: ld returned 1 exit status$ gcc -o test compiler_test.ccompiler_test.c:3:20: fatal error: iostream: No such file or directory #include <iostream>                    ^compilation terminated.$ g++ -o test compiler_test.c$ ./test hello$ g++ -o test compiler_test.cpp$ ./test hello*/


0 0
原创粉丝点击