Daniel Burrell wrote:
Hello,
I am currently using VC8 to compile xerces, I have added a project called
Tasks to the solution with a single file containing main() called
analysefile.cpp.
It is my intention to mess around with xerces in this file.
I'm following the programming guide, and have got stuck at the first stage.
Please take a look at the following screenshot which outlines my setup:
http://www.solong.co.uk/bugs/unresolved.jpg
After having copied and pasted code from the first window of
http://xerces.apache.org/xerces-c/program.html
I can't get my Tasks project to compile due to the following errors.
Since
Error 2 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: static void __cdecl
xercesc_2_8::XMLPlatformUtils::Terminate(void)"
([EMAIL PROTECTED]@xercesc_2_8@@SAXXZ) referenced in
function __catch$_main$0 analysefile.obj Tasks
Error 3 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: static void __cdecl
xercesc_2_8::XMLPlatformUtils::Initialize(char const * const,char const *
const,class xercesc_2_8::PanicHandler * const,class
xercesc_2_8::MemoryManager * const,bool)"
([EMAIL PROTECTED]@xercesc_2_8@@[EMAIL PROTECTED]
@[EMAIL PROTECTED]@[EMAIL PROTECTED]) referenced in function _main
analysefile.obj
Tasks
Error 4 error LNK2001: unresolved external symbol
"__declspec(dllimport) public: static char const * const
xercesc_2_8::XMLUni::fgXercescDefaultLocale"
([EMAIL PROTECTED]@xercesc_2_8@@2QBDB)
analysefile.obj Tasks
Error 5 fatal error LNK1120: 3 unresolved externals
D:\workspaces\test\xerces-c-src_2_8_0\Projects\Win32\VC8\xerces-all\Debug\Tasks.exe
Tasks
Have you specified the Xerces-C import library as input to the linker?
Surely it should still compile at this stage? I'm at a loss as to how to
resolve this. Any help much appreciated.
It's compiling, but it's not linking.
It should be noted however that the following code will compile:
#include <xercesc/util/PlatformUtils.hpp>
// Other include files, declarations, and non-Xerces-C++ initializations.
XERCES_CPP_NAMESPACE_USE
int main(int argc, char* argv[])
{
/* ALL THIS CODE COMMENTED OUT
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
// Do your failure processing here
return 1;
}
// Do your actual work with Xerces-C++ here.
XMLPlatformUtils::Terminate();
AND STOP HERE
*/
// Other terminations and cleanup.
return 0;
}
This program doesn't call any Xerces-C APIs, which is why you don't get
any unresolved symbol errors.
clearly it's something to do with the mention of XMLPlatformUtils::
Yes, you need to link with the Xerces-C import library. Take a look at
one of the sample applications to see what extra settings you need for
your project.
Dave