[Fedora]: Fedora当中使用C++编写程序

来源:互联网 发布:用户画像 大数据挖掘 编辑:程序博客网 时间:2024/05/16 07:52

1.安装必要套件 

$ sudo yum install gcc-c++ libstdc++-docs

2.编写hello world程序

$ vim hello.cpp

#include <iostream> using namespace std; int main(){     cout << "hello world.\n" << endl;     return 0;}
$ g++ hello.cpp

# 编译,然后运行

$ ./a.out 
hello world.

3.查看c++帮助

安装了libstdc++-docs后,我们可以借助man方便地查看帮助。

基本格式是man namespace::header,比如查看iostream类的成员

$ man std::iostream