linux 配置c++环境

在连接互联网的情况下

 

1、g++ --version。查看有无g++

 

2、yum install gcc-c++ 安装c++编译器,遇到is this ok,输入y

 

3、yum install gdb 安装调试工具,遇到is this ok,输入y

 

4、测试。

 

创建main.cpp

//main.cpp

#include<iostream>

#include "yy.cpp"

int main()

{

    called(); //进行调用

    return 0;

}

 

创建 yy.cpp

#include<iostream>

void called(){

     cout<<"Hello world!"<<endl;

}

 

输入:g++ main.cpp -o main

输入:./main

 

posted @ 2022-04-22 14:05  比较杂的代码工程师  阅读(612)  评论(0编辑  收藏  举报