1
我有两个文件:osm.h和osm.cppMakefile文件 - 创建一个静态库
我试图创建从中静态库,被称为“libosm.a”与Makefile文件。
我的cpp和h文件的工作(我编译他们没有Makefile),但我的Makefile不起作用。这是在Makefile:
CC = g++
RANLIB = ranlib
LIBSRC = osm.cpp
LIBOBJ=$(LIBSRC:.cpp=.o)
CFLAGS = -Wall -g -O0
LOADLIBES = -L./
OSMLIB = libosm.a
TARGETS = $(OSMLIB)
all: $(TARGETS)
osm.o: osm.cpp osm.h
$(CC) -c osm.cpp -o osm.o
$(TARGETS): $(LIBOBJ)
ar rcs $(OSMLIB) osm.o
ranlib $(OSMLIB)
clean:
rm osm.o $(TARGETS) $(OSMLIB) $(LIBOBJ)
depend:
makedepend -- $(CFLAGS) -- $(SRC) $(LIBSRC)
,这是我得到的错误的部分:
osm.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
谁能帮助?
也请写发出此错误消息的命令。 – 2012-03-07 14:45:58
在你的问题中添加'osm.o:'功能...'上方的行。它应该是由make生成的命令生成错误。 – 2012-03-07 15:24:41