|

楼主 |
发表于 2004-11-26 15:12:45
|
显示全部楼层
谢谢你的回贴,我知道用GCC的命令怎么将程序编译连接成动态库或静态库。我也按照你说的查了查论坛上的内容。
但是我有一个程序是从windows下移植到linux下的,程序有一些不兼容的地方我进行了改写,在kdevelop下Compile没有错误,但是make的时候最后一条命令执行时出错,程序有多个目录,我看到kdevelop在每个目录下都生成了一个makefile文件。而且每个目录下生成了一个lib**.a文件。执行的错误如下:
提示有undefined reference to ××××,但是这方法已经定义了,如果把这个方法的定义从.cpp文件拿到它声明的.h文件中就不会提示这个错误?是不是哪个选项没有设置好?刚用Kdevelop,请多执教!谢谢!!
/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -O0 -g3 -Wall -fpic -fno-exceptions -fno-check-new -fexceptions -lpthread -o lrc1 main.o RtiAmbServices.o ./bases/libbases.a ./LrcData/libLrcData.a ./cbMgr/libcbMgr.a ./clientIF/libclientIF.a ./init/libinit.a ./init/Parser/libParser.a ./LrcService/libLrcService.a ./kernel/libkernel.a ./serviceIF/libserviceIF.la ./NAL/libNAL.la
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x14): In function `DveSupportService: veSupportService[not-in-charge]()':
../LrcData/DveInteraction.h:140: undefined reference to `DveObjectHashList: veObjectHashList[in-charge](int)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x2a):../LrcData/DveInteraction.h:140: undefined reference to `DveInteractionHashList: veInteractionHashList[in-charge](int)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x5c):../LrcData/DveInteraction.h:140: undefined reference to `DveInteractionHashList::~DveInteractionHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x79):../LrcData/DveInteraction.h:140: undefined reference to `DveObjectHashList::~DveObjectHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0xa8): In function `DveSupportService: veSupportService[in-charge]()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:39: undefined reference to `DveObjectHashList: veObjectHashList[in-charge](int)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0xbe):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:39: undefined reference to `DveInteractionHashList: veInteractionHashList[in-charge](int)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0xf0):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:39: undefined reference to `DveInteractionHashList::~DveInteractionHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x10d):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:39: undefined reference to `DveObjectHashList::~DveObjectHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x15d): In function `DveSupportService::~DveSupportService [not-in-charge]()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:46: undefined reference to `DveInteractionHashList::~DveInteractionHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x16f):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:46: undefined reference to `DveObjectHashList::~DveObjectHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x1ad): In function `DveSupportService::~DveSupportService [in-charge]()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:46: undefined reference to `DveInteractionHashList::~DveInteractionHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x1bf):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:46: undefined reference to `DveObjectHashList::~DveObjectHashList [in-charge]()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x1d9): In function `DveSupportService::removeAndDeleteAll()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:51: undefined reference to `DveObjectHashList::removeAndDeleteAll()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x1ed):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:52: undefined reference to `DveInteractionHashList::removeAndDeleteAll()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x281): In function `DveSupportService::readFed()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:71: undefined reference to `DveReadFed(DveObjectHashList*, DveInteractionHashList*, DveRoutingSpaceHashList*, char const*)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x2b1): In function `DveSupportService::readFile()':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:75: undefined reference to `DveReadFile(DveObjectHashList*, DveInteractionHashList*, DveRoutingSpaceHashList*, char const*)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x2ce): In function `DveSupportService::getAttributeName(unsigned long, unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:84: undefined reference to `DveObjectHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x35e): In function `DveSupportService::getInteractionClassName(unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:110: undefined reference to `DveInteractionHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x3a2): In function `DveSupportService::getObjectClassName(unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:120: undefined reference to `DveObjectHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x458): In function `DveSupportService::getParameterName(unsigned long, unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:160: undefined reference to `DveInteractionHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x4e4): In function `DveSupportService::getAttributeRoutingSpaceHandle(unsigned long, unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:180: undefined reference to `DveObjectHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x574): In function `DveSupportService::getInteractionRoutingSpaceHandle(unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:200: undefined reference to `DveInteractionHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x58b):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:203: undefined reference to `DveInteraction::getSpaceHandle()'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x67e): In function `DveSupportService::setInteractionOrderType(unsigned long, TransportationOrder)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:237: undefined reference to `DveInteractionHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x692):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:238: undefined reference to `DveInteraction::setOrdering(TransportationOrder)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x6b2): In function `DveSupportService::isInteractionTSO(unsigned long)':
/root/lrc1/lrc1/LrcService/DveSupportService.cpp:243: undefined reference to `DveInteractionHashList::lookup(unsigned long)'
./LrcService/libLrcService.a(DveSupportService.o)(.text+0x6c3):/root/lrc1/lrc1/LrcService/DveSupportService.cpp:244: undefined reference to `DveInteraction::getOrdering()'
./LrcService/libLrcService.a(DveLocalService.o)(.text+0x11e7): In function `DveLocalService::getObjectClassHandle(char const*)':
/root/lrc1/lrc1/LrcService/DveLocalService.cpp:314: undefined reference to `DveObjectHashList::lookup(char const*)'
./LrcService/libLrcService.a(DveLocalService.o)(.text+0x1295): In function `DveLocalService::getInteractionClassHandle(char const*)':
/root/lrc1/lrc1/LrcService/DveLocalService.cpp:337: undefined reference to `DveInteractionHashList::lookup(char const*)'
./LrcService/libLrcService.a(DveLocalService.o)(.text+0x1303): In function `DveLocalService::getParameterHandle(char const*, unsigned long)':
/root/lrc1/lrc1/LrcService/DveLocalService.cpp:350: undefined reference to `DveInteraction::parameterHandle(char const*)'
./LrcService/libLrcService.a(DveLocalService.o)(.gnu.linkonce.t._ZN17DveSupportService22getAttributeLayerValueEmm+0x14): In function `DveSupportService::getAttributeLayerValue(unsigned long, unsigned long)':
../bases/DveRtiInterIF.h:1071: undefined reference to `DveObjectHashList::lookup(unsigned long)'
collect2: ld returned 1 exit gmake[3]: Leaving directory `/root/lrc1/lrc1'
gmake[2]: Leaving directory `/root/lrc1/lrc1'
gmake[1]: Leaving directory `/root/lrc1'
status
gmake[3]: *** [lrc1] Error 1
gmake[2]: *** [all-recursive] Error 1
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
*** failed *** |
|