makefile与交叉编译环境
Makefile文件
obj=main.o buf_send.o tcp_bind.o hua_cheng.o doit_pthread.o shang_chuan.o \
time_jiaodui.o changee.o\
dianchi_stop.o dianchi_suspend.o dianchi_regain.o power_down_recover_or_cl
ean.o\
changeIP.o alarmLed_control.o google.o time_test.o pthread_fun.o
target=main
#cc=gcc
cc= arm-none-linux-gnueabi-
C=-g
LP=-lpthread
$(target):$(obj)
$(cc)gcc $(C) $(LP) $^ -o $@
clean:
rm -rf *.o main
make时出错:
cc -c -o main.o main.c
cc -c -o buf_send.o buf_send.c
cc -c -o tcp_bind.o tcp_bind.c
cc -c -o hua_cheng.o hua_cheng.c
cc -c -o doit_pthread.o doit_pthread.c
doit_pthread.c: In function ‘doit_pthread’:
doit_pthread.c:100: warning: passing argument 3 of ‘pthread_create’ from incompa
tible pointer type
cc -c -o shang_chuan.o shang_chuan.c
cc -c -o time_jiaodui.o time_jiaodui.c
cc -c -o changee.o changee.c
cc -c -o dianchi_stop.o dianchi_stop.c
cc -c -o dianchi_suspend.o dianchi_suspend.c
cc -c -o dianchi_regain.o dianchi_regain.c
cc -c -o power_down_recover_or_clean.o power_down_recover_or_clean.c
cc -c -o changeIP.o changeIP.c
cc -c -o alarmLed_control.o alarmLed_control.c
cc -c -o google.o google.c
cc -c -o time_test.o time_test.c
cc -c -o pthread_fun.o pthread_fun.c
arm-none-linux-gnueabi-gcc -g -lpthread main.o buf_send.o tcp_bind.o hua_cheng.o
doit_pthread.o shang_chuan.o time_jiaodui.o changee.o dianchi_stop.o dianchi_su
spend.o dianchi_regain.o power_down_recover_or_clean.o changeIP.o alarmLed_contr
ol.o google.o time_test.o pthread_fun.o -o main
/root/softback/arm-2007q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.0/../../../.
./arm-none-linux-gnueabi/bin/ld: main.o: Relocations in generic ELF (EM: 3)
main.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [main] E"
我没有用交叉编译是,make是没有错误的。
我单独用arm-none-linux-gnueabi-gcc 编译单个文件时也没有错误。
希望大家帮帮忙,给我指点一下迷津。
在此感谢大家了。
------解决方案--------------------Makefile文件应该改成这样
obj=main.o buf_send.o tcp_bind.o hua_cheng.o doit_pthread.o shang_chuan.o \
time_jiaodui.o changee.o\
dianchi_stop.o dianchi_suspend.o dianchi_regain.o power_down_recover_or_cl
ean.o\
changeIP.o alarmLed_control.o google.o time_test.o pthread_fun.o
target=main
#cc=gcc
cc= arm-none-linux-gnueabi-<