collect2:ld返回1退出状态编译错误

时间:2014-04-16 16:36:56

标签: c++ linux makefile

尝试在friendlyARM qtopia 2.0.0上编译程序后,我收到此错误:

/sdcard/images/makef # make -f Makefile
gcc -o main obj/main.o obj/serial.o obj/fb.o obj/menu_main.o obj/timer.o obj/cmdin.o obj/buzzer.o obj/statemachine.o obj/inout.o obj/network.o obj/text_file_input.o obj/text_file_input_oven.o -I./ -lgd -lrt
/usr/bin/ld:/usr/lib/gcc/arm-linux-gnueabi/4.4.1/../../../librt.so: file format not recognized; treating as linker script
/usr/bin/ld:/usr/lib/gcc/arm-linux-gnueabi/4.4.1/../../../librt.so:2: syntax error
collect2: ld returned 1 exit status
make: *** [main] Error 1
/sdcard/images/makef #          

makefile:

IDIR =./
CC=gcc
CFLAGS=-I$(IDIR)

ODIR=obj
LDIR =./

LIBS=-lgd -lrt

_DEPS = main.h Makefile
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = main.o serial.o fb.o menu_main.o timer.o cmdin.o buzzer.o statemachine.o inout.o network.o text_file_input.o text_file_input_oven.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))


$(ODIR)/%.o: %.c $(DEPS)
    $(CC) -c -o $@ $< $(CFLAGS)

main: $(OBJ)
    gcc -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
    rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ 

0 个答案:

没有答案