linux中编辑cpp 编译 执行

#include <iostream>
#include <thread>
#include <unistd.h>
int main(int argc,char *argv[])
{
     while(1)
{
    std::cout<<"Hello WWold!!!"<<std::endl;
    sleep(10);
}
return 0;
}

①编译指令:   g++ -std=c++11 Compile.cpp -o compile

   执行指令:   ./compile

 ②创建自己的makefile文件去编译生成执行文件:

     vim makefile

all: 
        #g++ -std=c++11 Compile.cpp -o compile 
        g++ -std=c++11 Compile.cpp -o compile.out

     make

原文地址:https://www.cnblogs.com/mathyk/p/13173742.html