零基础学习Linux编程之Ubuntu下编译C++程序
1.准备C++源码文件:
2.准备CMakeLists.txt文件(给CMake编译器用的)
hello.cpp:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char sz[] = "Hello, World!";
cout << sz << endl;
return 0;
}
CMakeLists.txt:
#CmakeLists.txt
PROJECT(hello_project)
ADD_EXECUTABLE(hello hello.cpp)</