Hi -
I am trying to update some code I have to QT- 4.6.2 with VS2008 and it no longer seems to want to link in the xerces-c library.
so I have created 2 tiny programs (they really are pretty non-functional) to debug the issue; the first makes no use of Qt and works fine:
int
main (int argc, char* argv[])
{
try
{
std::auto_ptr<material_t> mt (material ("palletmix.xml"));
std::cout << "palletmix.xml loaded !" << std::endl;
}
catch (const xml_schema::exception& e)
{
std::cerr << e << std::endl;
return 1;
}
}
int
main (int argc, char* argv[])
{
try
{
std::auto_ptr<material_t> mt (material ("palletmix.xml"));
std::cout << "palletmix.xml loaded !" << std::endl;
}
catch (const xml_schema::exception& e)
{
std::cerr << e << std::endl;
return 1;
}
}
To copy to clipboard, switch view to plain text mode
This uses xerces-c_3D.lib in the linker input section...
when I try to turn this into the most trivial Qt program: ( I really should use Qt Streams etc , but this is the most trivial change I could see
#include <QtCore/QCoreApplication>
#include <memory> // std::auto_ptr
#include <iostream>
#include "material_template.hxx"
int main(int argc, char *argv[])
{
return a.exec();
try
{
std::auto_ptr<material_t> mt (material ("palletmix.xml"));
std::cout << "palletmix.xml loaded !" << std::endl;
}
catch (const xml_schema::exception& e)
{
std::cerr << e << std::endl;
return 1;
}
}
#include <QtCore/QCoreApplication>
#include <memory> // std::auto_ptr
#include <iostream>
#include "material_template.hxx"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
try
{
std::auto_ptr<material_t> mt (material ("palletmix.xml"));
std::cout << "palletmix.xml loaded !" << std::endl;
}
catch (const xml_schema::exception& e)
{
std::cerr << e << std::endl;
return 1;
}
}
To copy to clipboard, switch view to plain text mode
I get linker errors:
1>------ Build started: Project: MostQtXml, Configuration: Debug Win32 ------
1>Compiling...
1>material_template.cxx
1>main.cpp
1>Generating Code...
1>Linking...
1>material_template.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_0::InputSource::getEncoding(void)const " (?getEncoding@InputSource@xercesc_3_0@@UBEPBGXZ)
1>material_template.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_0::InputSource::getPublicId(void)const " (?getPublicId@InputSource@xercesc_3_0@@UBEPBGXZ)
1>material_template.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_0::InputSource::getSystemId(void)const " (?getSystemId@InputSource@xercesc_3_0@@UBEPBGXZ)
1>material_template.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_0::InputSource::setEncoding(unsigned short const * const)" (?setEncoding@InputSource@xercesc_3_0@@UAEXQBG@Z)
...
...
if I change the name of the xerces library I get a can't open file error, so it is seeing the library:
1>------ Build started: Project: MostQtXml, Configuration: Debug Win32 ------
1>Linking...
1>LINK : fatal error LNK1181: cannot open input file 'xerces-c_3cD.lib'
1>Build log was saved at "file://c:\Documents and Settings\116100\My Documents\MCNPX\MostQtXml\MostQtXml\Debug\BuildLog .htm"
1>MostQtXml - 1 error(s), 0 warning(s)
How do you add an external library?
Bookmarks