相关疑难解决方法(0)

如何使用Clang编译C++?

我在Ubuntu中使用apt-get 安装了Clang,我可以使用它成功编译C文件.但是,我不知道如何通过它编译C++.编译C++需要做什么?

c++ clang

86
推荐指数
5
解决办法
10万
查看次数

用gcc编译C++程序

问题:如何使用gcc编译器编译C++程序?

info.c:

#include<iostream>
using std::cout;
using std::endl;
int main()
{
   #ifdef __cplusplus
   cout << "C++ compiler in use and version is " << __cplusplus << endl;
   #endif
   cout <<"Version is " << __STDC_VERSION__ << endl;
   cout << "Hi" << __FILE__ << __LINE__ << endl;
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译 info.c

$ gcc info.C

Undefined                       first referenced
 symbol                             in file
cout                                /var/tmp/ccPxLN2a.o
endl(ostream &)                     /var/tmp/ccPxLN2a.o
ostream::operator<<(ostream &(*)(ostream &))/var/tmp/ccPxLN2a.o
ostream::operator<<(int)            /var/tmp/ccPxLN2a.o
ostream::operator<<(long)           /var/tmp/ccPxLN2a.o
ostream::operator<<(char const *)   /var/tmp/ccPxLN2a.o
ld: fatal: Symbol referencing errors. No output written …
Run Code Online (Sandbox Code Playgroud)

c++ gcc gnu g++

68
推荐指数
5
解决办法
17万
查看次数

标签 统计

c++ ×2

clang ×1

g++ ×1

gcc ×1

gnu ×1