linux中编辑cpp 编译 执行

Posted on 2020-06-21 19:40  yacbo  阅读(638)  评论(0编辑  收藏  举报

 

#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

Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes