首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

这个简单的makefile如何写

2012-02-04 
这个简单的makefile怎么写网上看的第一个程序text.c#include stdio.hmain(){int a5printf(%d\n,a)}

这个简单的makefile怎么写
网上看的
第一个程序text.c
#include <stdio.h>
main()
{
int a=5;
printf("%d\n",a);
}
第二个程序run.c
#include <stdio.h>
main()
{
int ret;
ret = system("./test");
ret = (ret>>8);
printf("%d\n",ret);
}
makefile怎么写?
#makefile
xxx:text.o run.o
  gcc -o xxx text.o run.o
text.o:text.c
  gcc -c text.c
run.o:run.c
  gcc -c run.c
为什么不行啊
程序错误?

[解决办法]
makefile看上去没问题,但gcc前要用TAB而非空格就可以了
但你的程序是有问题的,二个程序都有main,是不能生成xxx文件的

热点排行
Bad Request.