可以的,CentOS 完全可以运行 C++ 程序。
下面给你一个清晰的说明和操作示例:
g++)g++ --version
如果提示 command not found,说明还没安装。
sudo yum install -y gcc-c++
CentOS 8 / Stream:
sudo dnf install -y gcc-c++
// hello.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello CentOS" << endl;
return 0;
}
g++ hello.cpp -o hello
./hello
输出:
Hello CentOS
glibc 版本chmod +x hello
ldd hello
✅ CentOS 是非常适合运行 C++ 程序的 Linux 发行版
✅ 服务器、工业、科研环境都广泛使用
✅ 只要有 g++ 或预编译的二进制文件即可运行
如果你有具体需求(比如:
可以继续问我。