hi,
i'm using c++ in cygwin environment under win32 .my classes use the xercesc c++ libraries which i have built with cygwin on windows.
my c++ source code compiles into .o files but the linker just wont
work.
my LIB env. variable is set to /cygdrive/c/lib , lib directory exists under c:\ and contains all necessary .a libraries.
the same problem occurs with gcc on pure windows environment when im not using cygwin.i just used cygwing becasue i thought it was a environment prob. so i rebuilt the libraries i needed for use but nothing changed.
i think it's a linker issue.
my command for linking is
g++ -L$LIB -lxerces-c27.dll -lxerces-depdom.dll Trs_Main.o Trs.o Descriptor.o -osplitter.exe
i am getting lots of "undefined reference to" errors.

/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
Trs.o: In function `_ZN8Trs8splitGenEPN11xercesc_2_711DOMDocumentEPNS0_10DOMElementE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:255: undefined reference to `Trs::trs_desc'
Trs.o: In function `_ZN8Trs8splitGenEPN11xercesc_2_711DOMDocumentEPNS0_10DOMElementE':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:16: undefined reference to `xercesc_2_7::XMLString::transcode(char const*)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:16: undefined reference to `xercesc_2_7::XMLString::transcode(char const*)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
Trs.o: In function `_ZN8Trs8splitGenEPN11xercesc_2_711DOMDocumentEPNS0_10DOMElementE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:255: undefined reference to `Trs::trs_desc'
Trs.o: In function `_ZN8Trs8splitGenEPN11xercesc_2_711DOMDocumentEPNS0_10DOMElementE':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:16: undefined reference to `xercesc_2_7::XMLString::transcode(char const*)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.h:21: undefined reference to `xercesc_2_7::XMLString::release(unsigned short**)'
Trs.o: In function `_ZN8TrsC2EPcS0_':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.cpp:107: undefined reference to `vtable for Trs'
Trs.o: In function `_ZN8TrsC1EPcS0_':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.cpp:107: undefined reference to `vtable for Trs'
Trs.o: In function `_ZN8Trs4readEv':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.cpp:167: undefined reference to `xercesc_2_7::XMLUni::fgXercescDefaultLocale'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Trs.cpp:167: undefined reference to `xercesc_2_7::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_2_7::PanicHandler*
, xercesc_2_7::MemoryManager*, bool)'
Descriptor.o: In function `_ZN8Descriptor5parseEPcS0_':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:32: undefined reference to `xercesc_2_7::XMLUni::fgXercescDefaultLocale'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:32: undefined reference to `xercesc_2_7::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_2_7::PanicHandler*,
xercesc_2_7::MemoryManager*, bool)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:39: undefined reference to `xercesc_2_7::XMemory::operator new(unsigned int)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:39: undefined reference to `xercesc_2_7::XMLPlatformUtils::fgMemoryManager'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:39: undefined reference to `xercesc_2_7::SAXParser::SAXParser(xercesc_2_7::XMLValidator*, xercesc_2_7::MemoryManager*, xerc
esc_2_7::XMLGrammarPool*)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:39: undefined reference to `xercesc_2_7::XMemory::operator delete(void*)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:40: undefined reference to `xercesc_2_7::SAXParser::setValidationScheme(xercesc_2_7::SAXParser::ValSchemes)'
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:91: undefined reference to `xercesc_2_7::XMLPlatformUtils::Terminate()'
Descriptor.o: In function `_ZN8Descriptor12buildHeadingERN11xercesc_2_710AttributesE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor12startElementEPKtS1_S1_RN11xercesc_2_710AttributesE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor12startElementEPKtS1_S1_RN11xercesc_2_710AttributesE':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:169: undefined reference to `Descriptor::mandatoryElements'
Descriptor.o: In function `_ZN8Descriptor10endElementEPKtS1_S1_':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor10charactersEPKtj':
/cygdrive/c/include/xercesc/sax/SAXException.hpp:90: undefined reference to `xercesc_2_7::XMLPlatformUtils::fgMemoryManager'
/cygdrive/c/include/xercesc/sax/SAXException.hpp:94: undefined reference to `xercesc_2_7::XMLString::transcode(char const*, xercesc_2_7::MemoryManager*)'
Descriptor.o: In function `_ZN8Descriptor10charactersEPKtj':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:203: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor10endElementEPKt':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor12startElementEPKtRN11xercesc_2_713AttributeListE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:687: undefined reference to `Descriptor::null_char'
Descriptor.o: In function `_ZN8Descriptor12startElementEPKtRN11xercesc_2_713AttributeListE':
/cygdrive/c/Documents and Settings/williamP/workspace/splits/Descriptor.cpp:278: undefined reference to `Descriptor::mandatoryElements'
Descriptor.o: In function `_ZSteqIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_EPKS3_':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713DTDEntityDeclE[vtable for xercesc_2_7::DTDEntityDecl]+0x10): undefined reference to `xercesc_2_7::DTDEntit
yDecl::isSerializable() const'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713DTDEntityDeclE[vtable for xercesc_2_7::DTDEntityDecl]+0x14): undefined reference to `xercesc_2_7::DTDEntit
yDecl::serialize(xercesc_2_7::XSerializeEngine&)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713DTDEntityDeclE[vtable for xercesc_2_7::DTDEntityDecl]+0x18): undefined reference to `xercesc_2_7::DTDEntit
yDecl::getProtoType() const'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713XMLAttDefListE[vtable for xercesc_2_7::XMLAttDefList]+0x10): undefined reference to `xercesc_2_7::XMLAttDe
fList::isSerializable() const'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713XMLAttDefListE[vtable for xercesc_2_7::XMLAttDefList]+0x14): undefined reference to `xercesc_2_7::XMLAttDe
fList::serialize(xercesc_2_7::XSerializeEngine&)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.rdata$_ZTVN11xercesc_2_713XMLAttDefListE[vtable for xercesc_2_7::XMLAttDefList]+0x18): undefined reference to `xercesc_2_7::XMLAttDe
fList::getProtoType() const'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.text$_ZN11xercesc_2_712SAXExceptionD0Ev[xercesc_2_7::SAXException::~SAXException()]+0x29): undefined reference to `xercesc_2_7::XMem
ory::operator delete(void*)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.text$_ZN11xercesc_2_713XMLAttDefListD0Ev[xercesc_2_7::XMLAttDefList::~XMLAttDefList()]+0x13): undefined reference to `xercesc_2_7::X
Memory::operator delete(void*)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.text$_ZN11xercesc_2_713DTDEntityDeclD0Ev[xercesc_2_7::DTDEntityDecl::~DTDEntityDecl()]+0x14): undefined reference to `xercesc_2_7::X
MLEntityDecl::~XMLEntityDecl()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.text$_ZN11xercesc_2_713DTDEntityDeclD0Ev[xercesc_2_7::DTDEntityDecl::~DTDEntityDecl()]+0x1c): undefined reference to `xercesc_2_7::X
Memory::operator delete(void*)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/basic_string.h:(.text$_ZN11xercesc_2_713DTDEntityDeclD1Ev[xercesc_2_7::DTDEntityDecl::~DTDEntityDecl()]+0x13): undefined reference to `xercesc_2_7::X
MLEntityDecl::~XMLEntityDecl()'
collect2: ld returned 1 exit status

any help on this is appreciated.
regards,
william

g++ -L$LIB -lxerces-c27.dll -lxerces-depdom.dll Trs_Main.o Trs.o Descriptor.o -osplitter.exe

Try this, it might work:

g++ -L$LIB -o splitter Trs_Main.o Trs.o Descriptor.o -lfull_path/xerces-c27.dll -lfull_path/xerces-depdom.dll


Good luck, LamaBot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.