编写Makefile

来源:互联网 发布:linux vi编辑命令 编辑:程序博客网 时间:2024/06/03 16:49

1.简易版

程序只有一个string.cpp和solution.h文件,生成main可执行文件,使用c++11编译
CC = g++CXXFLAGS := -std=c++11start: string.o$(CC) $(CXXFLAGS) -o main string.o./mainrm -f *.o.PHONY: cleanclean:rm -f *.o
贴一下有用的博客,有空再研究一下
陈皓的Makefile系列博文
http://blog.csdn.net/tototuzuoquan/article/details/38459119
http://www.cnblogs.com/wang_yb/p/3990952.html

2.常见问题

1.若是文件中含有math.h文件,在编写makefile时需要注意,在$(CC)行最后添加 -lm编写选项,否则无法使用math.h中的函数


0 0
原创粉丝点击