Overview
Features
Download
Documentation
Community
Add-Ons & Services

Linking Problems with Poco XML Library

Please post support and help requests here.

Linking Problems with Poco XML Library

Postby potatosoftware » 13 May 2009, 18:49

I'm very confused.

I 'm trying to exploit the SAX parsing feature of Poco XML.

To that end I am linking with Poco Foundation and Poco XML libraries.

My types are based on wchar_t. Because of that I compiled Poco XML library with adding XML_UNICODE and XML_UNICODE_WCHAR_T to the Preprocessor definitions.

I am using the /MD runtime library option for all the DLLs and my Exe. (release built).

I get no compilation error in my project : the XMLString is seen as an std::wstring types as I want. Nevertheless I have linking problems in the portion of code that consume the Poco XML code :

Linking...
Creating library Release/DocxFormatter.lib and object Release/DocxFormatter.exp
LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library
ElementaryText.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall Poco::XML::SAXParser::parse(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (__imp_?parse@SAXParser@XML@Poco@@UAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z) referenced in function "public: bool __thiscall CSaxDispatcher::parseDocument(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >)" (?parseDocument@CSaxDispatcher@@QAE_NV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
ElementaryText.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall Poco::XML::SAXParser::setProperty(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,void *)" (__imp_?setProperty@SAXParser@XML@Poco@@UAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@PAX@Z) referenced in function "public: bool __thiscall CSaxDispatcher::parseDocument(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >)" (?parseDocument@CSaxDispatcher@@QAE_NV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
ElementaryText.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const Poco::XML::XMLReader::PROPERTY_LEXICAL_HANDLER" (__imp_?PROPERTY_LEXICAL_HANDLER@XMLReader@XML@Poco@@2V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@B)
ElementaryText.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const Poco::XML::XMLReader::FEATURE_NAMESPACE_PREFIXES" (__imp_?FEATURE_NAMESPACE_PREFIXES@XMLReader@XML@Poco@@2V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@B)
ElementaryText.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall Poco::XML::SAXParser::setFeature(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,bool)" (__imp_?setFeature@SAXParser@XML@Poco@@UAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@_N@Z) referenced in function "public: bool __thiscall CSaxDispatcher::parseDocument(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >)" (?parseDocument@CSaxDispatcher@@QAE_NV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
ElementaryText.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const Poco::XML::XMLReader::FEATURE_NAMESPACES" (__imp_?FEATURE_NAMESPACES@XMLReader@XML@Poco@@2V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@B)
Release/docxRend.dll : fatal error LNK1120: 6 unresolved externals


It's as if the linker is expecting to find the functions with arguments std::string and not std::wstring !! When actually it should look for those who have the std::wstring input type.


How can this happen ??

Note that I also inserted the XML_UNICODE and XML_UNICODE_WCHAR_T preprocessor definition, otherwise the project will fail at compile time.

It's wear, fantastic : the compiler is behaving normally this way : but the linker is as fooled by strange, invisible creatures.
Can you help ? Thanks in advance.
potatosoftware
 
Posts: 3
Joined: 13 May 2009, 18:26

Re: Linking Problems with Poco XML Library

Postby Protogenes » 30 Sep 2009, 16:24

I also have a big problem with XML_UNICODE_WCHAR_T.
XML compiled fine. Util fails on linking, because it uses the wrong XMLString type. I compiled Util with XML_UNICODE_WCHAR_T defined. This is failing on compile time on various functions. All where passing std::string as XMLString==wstring. I tried fixing this up, but it is just too much.
I'm from the Visual C++ world, there is a TCHAR type which is char or wchar depending on an _UNICODE define, which is set automatic through the project settings.
I think it would be much more fun if poco would be based on a tstring class, at least for windows developers who have to deal with windows api and need widestrings.
Protogenes
 
Posts: 3
Joined: 29 Sep 2009, 15:47

Re: Linking Problems with Poco XML Library

Postby alex » 30 Sep 2009, 23:41

Protogenes wrote:I also have a big problem with XML_UNICODE_WCHAR_T.
XML compiled fine. Util fails on linking, because it uses the wrong XMLString type. I compiled Util with XML_UNICODE_WCHAR_T defined. This is failing on compile time on various functions. All where passing std::string as XMLString==wstring. I tried fixing this up, but it is just too much.
I'm from the Visual C++ world, there is a TCHAR type which is char or wchar depending on an _UNICODE define, which is set automatic through the project settings.
I think it would be much more fun if poco would be based on a tstring class, at least for windows developers who have to deal with windows api and need widestrings.


Well, perhaps it would be more fun for some people, but the sad part would be that we should drop the "POrtable" from the project name ;-).

To be portable, POCO is UTF-8 based and comes with POCO_WIN32_UTF8, which provides UTF-8 support on Windows, enabled by default. Why UTF-8? Because the size of wchar_t is not guaranteed across platforms and UTF-8 is the only encoding that holds everything, from ASCII to UTF-32. So if you are on windows and using Unicode strings, you can convert back and forth using UnicodeConverter. Also, check the comment in this bug report.

You may also check Pete Becker's note on Unicode and new C++ standard.
alex
 
Posts: 1145
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron