1. 新建一个test文件夹,其中再新建.h和.cpp文件
mkdir test
cd test
mkdir include
mkdir src
cd include
touch myhead.h
touch myhend.cpp
cd ..
cd src
touch main.cpp
2. 编辑.h 和.cpp
gedit myhead.h
gedit mygead.cpp
gedit main.cpp
3. 编译链接
cd include
g++ -c myhead.cpp -o myhead.o
cd src
g++ main.cpp -o main -I ../include ../include/myhead.o
./main