无法创建
问题描述:
我尝试使用下面的Makefile做一个简单的档案归档简单:无法创建
INC :=-Ilibs/rapidxml-1.13
all:
$(CXX) -c $(INC) -o dove.o dove.hpp
ar rvs libdove.a dove.o
ranlib libdove.a
clean:
rm -f dove.o libdove.a
的dove.hpp文件有#include "rapidxml.hpp"
,你可以看到我指向特定rapidxml在编译时。 make all
目标运行完成,但1)当rapidxml + dove.hpp只有大约150K时,输出dove.o是巨大的(19MB!),并且2)最终的libdove.a或dove.o都不可用物体:
[[email protected] dove]$ nm dove.o
nm: dove.o: File format not recognized
[[email protected] dove]$ nm libdove.a
nm: dove.o: File format not recognized
[... in other project...]
[[email protected] dove]$ g++ -o bin/AntHybrid build/*.o -L/home/hamiltont/foobar/dove -ldove
/home/hamiltont/foobar/dove/libdove.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status