#include<iostream> using namespace std; int main() { cout << "Hello World!"<< endl; return 0; }
#指定cmake最低版本
cmake_minimum_required(VERSION 2.8) #指定项目名称 project(c_hello) #设置源文件名称 set(DIR_SRC Helloworld.cpp) #生成可执行文件 名称 add_executable(C_helloworld ${DIR_SRC})
g++编译比较简单 创建.cpp后 执行 g++ Helloworld.cpp -o hello 即在当前文件夹下创建hello可执行文件
原文:https://www.cnblogs.com/wangxiaobei2019/p/12010741.html