在/home/study/weatherdata/project/idc2下创建如下文件夹
在c文件夹下,创建crtsurfdata1.cpp
#include "_public.h" CLogFile logfile(10); int main(int argc, char *argv[]){ // printf("argc %s \n",argc); // inifile outpath logfile if( argc != 4){ printf("Using: ./crtsurfdata1 inifile outpath logfile\n"); return -1; } if(logfile.Open(argv[3]) == false){ printf("logfile.Open(%s) failed.\n", argv[3]); return -1; } logfile.Write("crtsurfdata1 开始运行。\n "); for(int ii = 0;ii<10000000;ii++) logfile.Write("这是第%010d条日志记录。\n",ii); logfile.Write("crtsurfdata1 结束运行。\n "); return 0; }
在c文件夹下创建makefile
PUBINCL = -I/home/study/weatherdata/project/public PUBCPP = /home/study/weatherdata/project/public/_public.cpp CFLAGS = -g all:crtsurfdata1 crtsurfdata1:crtsurfdata1.cpp g++ $(CFLAGS) -o crtsurfdata1 crtsurfdata1.cpp $(PUBINCL) $(PUBCPP) -lm -lc cp crtsurfdata1 ../bin/. clean: rm crtsurfdata1
使用make命令
执行
/home/study/weatherdata/project/idc2/bin/crtsurfdata1 /home/study/weatherdata/project/idc2/ini/stcode.ini /tmp/surfdata /home/study/weatherdata/project/idc2/crtsurfdata1.log
作者:Work Hard Work Smart
出处:http://www.cnblogs.com/linlf03/
欢迎任何形式的转载,未经作者同意,请保留此段声明!