Hi,
Im trying to run a sample program (the source code is included), the program is compiling with no errors, but unable to link.
can u kindly suggest some solution.
 
first.cpp
=============
#include <util/PlatformUtils.hpp>
#include <iostream.h>
#include <parsers/SAXParser.hpp>
#include <sax/DocumentHandler.hpp>
#include <sax/HandlerBase.hpp>
 
int main (int argc, char* args[])
{
    try {
        XMLPlatformUtils::Initialize();
    }
    catch (const XMLException& toCatch) {
        cout << "Error during initialization! :\n"
             << toCatch.getMessage() << "\n";
        return 1;
    }
 
    char* xmlFile = "x1.xml";
    SAXParser* parser = new SAXParser();
    parser->setDoValidation(true);    // optional.
        parser->setDoNamespaces(true);    // optional
 
    DocumentHandler* docHandler = new HandlerBase();
    ErrorHandler* errHandler = (ErrorHandler*) docHandler;
    parser->setDocumentHandler(docHandler);
    parser->setErrorHandler(errHandler);
 
    try {
        parser->parse(xmlFile);
    }
    catch (const XMLException& toCatch) {
        cout << "\nFile not found: '" << xmlFile << "'\n"
             << "Exception message is: \n"
             << toCatch.getMessage() << "\n" ;
        return -1;
    }
}
 

COMPILATION
===============
 
[root@NetteamUSA include]# c++ -c first.cpp -I/big/XERCES/xerces-c-src1_4_0/include [ENTER]
[root@NetteamUSA include]#
 
No Errors.
 

LINKING
========
 
[root@NetteamUSA include]# c++ -o first first.o
first.o: In function `main':
first.o(.text+0xa): undefined reference to `XMLPlatformUtils::Initialize(void)'
first.o(.text+0x32): undefined reference to `SAXParser::SAXParser(XMLValidator *)'
first.o(.text+0x57): undefined reference to `SAXParser::setDoValidation(bool)'
first.o(.text+0x6a): undefined reference to `SAXParser::setDoNamespaces(bool)'
first.o(.text+0x13a): undefined reference to `XMLException type_info function'
first.o(.text+0x16f): undefined reference to `XMLException::getMessage(void) const'
first.o(.text+0x239): undefined reference to `XMLException type_info function'
first.o(.text+0x26e): undefined reference to `XMLException::getMessage(void) const'
first.o: In function `HandlerBase::fatalError(SAXParseException const &)':
first.o(.HandlerBase::gnu.linkonce.t.fatalError(SAXParseException const &)+0x1e): undefined reference to `SAXParseException::SAXParseException(SAXParseException const &)'
first.o(.HandlerBase::gnu.linkonce.t.fatalError(SAXParseException const &)+0x31): undefined reference to `SAXParseException::~SAXParseException(void)'
collect2: ld returned 1 exit status
Regards
Prasanna Bhale
[EMAIL PROTECTED]
Direct #: 916-928-6393
http://www.NetTeam.net
Net Team Inc.
2101, Arena Blvd.
Suite 100
Sacramento CA - 95834
Main #:  916.566.1120
Fax #:  916.566.1188

Reply via email to