最近遇到這樣腦纏問題,在糾結中;其實就是沒有弄清楚原理:
#Makefile Example
test :hello.o test1.o test2.o
gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
gcc -c hello.c
test1.o :test1.c head1.h
gcc -c test1.c
test2.o :test2.c head2.h
gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
~
~
~
這樣用gcc編譯的,只能在windows環境下運行,而不能在ARM下運行
也不能用arm-linux-gcc 編譯(最近就是犯了大錯,在這裏糾結,現在才知道原理)
若想要在arm環境下運行,在makefile中把gcc 改爲arm-linux-gcc,這樣就可以在arm中運行了
#Makefile Example
test :hello.o test1.o test2.o
arm-linux-gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
arm-linux-gcc -c hello.c
test1.o :test1.c head1.h
arm-linux-gcc -c test1.c
test2.o :test2.c head2.h
arm-linmux-gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
原創,希望對大幾有用。