ubuntu--gcc安装及hello world程序测试

    xiaoxiao2021-03-25  131

    1.安装

    sudo apt-get install build-essential

    2.源代码编写 hello.cpp

    #include <iostream> int main() { std::cout<<"hello world!\n"; return 0; }

    3.编译

    gcc hello.cpp -o hello 错误:undefined reference to `std::cout` 是因为:gcc编译会把程序处理c程序 C++: g++ hello.cpp -o hello C: gcc hello.cpp -o hello

    4.运行

    ./hello
    转载请注明原文地址: https://ju.6miu.com/read-9871.html

    最新回复(0)