2008年8月10日星期日

编译hello world也能出错……

代码就是:

[code:c]
#include "stdio.h"
int main()
{
printf("hello, world \n");
return 0;
}
[/code]

Makefile:
[code]
CC=arm-uclibc-gcc
EXEC = hello
OBJS = hello.o
CFLAGS +=
LDFLAGS+=-elf2flt -static

all:$(EXEC)
$(EXEC): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)

clean:
-rm -f $(EXEC) *.elf *.gdb *.o
[/code]

make一下发现错误:
hello.c:1: '#include' expects 'FILENAME' or '半天都没明白是怎么回事,后来又在linux里用gedit编辑了一个新的hello.c,可以了……
原来原因就是:不能在windows里写程序拿到linux里去编译 -_-!

没有评论:

发表评论