Boost logo

Boost :

From: gavin_at_[hidden]
Date: 2001-12-04 22:48:31


Environment: vc6 sp5 + StlPort 4.5.1 + boost 1.26.0
StlPort 4.5.1 is compiled with its custom IO streams.

When I compile & link a program that uses the StlPort & the boost regex library, I receive the linker errors included at the bottom of this email. The compiler is definately linking to the vc6-stlport* libs, so that's not the problem.

If I compile & link the same program without using the StlPort (ie the default vc6 STL etc), the linker problems disappear.

I can successfully compile & link programs that use just the StlPort.

When building the regex library, I have tried using both Jam and the vc6.mak file. There were no errors during the compilation of the library. Either compilation of the library produces this error. It happens for release & debug builds of the program.

Note: I had to shorten the feature names in the jam files to avoid errors about file name length during compilation.

Can some help me identify what I am doing wrong? It must be my error, as other people on this mailing list seem to be using StlPort 4.5 & the boost regex library.

I placed #ifdef/#error/#endif conditionals in w32_regex_traits.cpp to prove that the w32_* classes are being compiled whilst using the StlPort, so I know that the build of the regex library *should* have the missing functions in it.

Perhaps there is an issue with namespaces I am not aware of? I noticed the name '_STL::char_traits<char>' in the linker error - perhaps when the library is being compiled, the '_STL::' namespace isn't being appended? This could cause a problem when looking for the function in the .lib file... (Okay, it is an unlikely long shot, but I am clasping at straws here!)

I've included the entire linker error. Sorry it is so long, but I didn't want to leave anything out. Also, the small snippet of regex code I am using is also listed at the bottom of the file.

The linker message in full is:
Linking...
LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib "libcmt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
XmlFormat.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::w32_regex_traits<char>::transform_primary(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > &,class _STL::basic_str
ing<char,class _STL::char_traits<char>,class _STL::allocator<char> > const &)" (?transform_primary@?$w32_regex_traits_at_D@boost@@SAXAAV?$basic_string_at_DV?$char_traits_at_D@_STL@@V?$allocator_at_D@2@@_STL@@ABV34@@Z)
XmlFormat.obj : error LNK2001: unresolved external symbol "protected: static bool __cdecl boost::re_detail::w32_traits_base::do_lookup_collate(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > &,char const *)"
 (?do_lookup_collate_at_w32_traits_base_at_re_detail_at_boost@@KA_NAAV?$basic_string_at_DV?$char_traits_at_D@_STL@@V?$allocator_at_D@2@@_STL@@PBD_at_Z)
XmlFormat.obj : error LNK2001: unresolved external symbol "public: static class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > __cdecl boost::re_detail::w32_traits_base::error_string(unsigned int)" (?error_strin
g_at_w32_traits_base_at_re_detail_at_boost@@SA?AV?$basic_string_at_DV?$char_traits_at_D@_STL@@V?$allocator_at_D@2@@_STL@@I_at_Z)
XmlFormat.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::w32_regex_traits<char>::transform(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > &,class _STL::basic_string<char
,class _STL::char_traits<char>,class _STL::allocator<char> > const &)" (?transform@?$w32_regex_traits_at_D@boost@@SAXAAV?$basic_string_at_DV?$char_traits_at_D@_STL@@V?$allocator_at_D@2@@_STL@@ABV34@@Z)
Debug/XmlFormat.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

XmlFormat.exe - 5 error(s), 1 warning(s)

The snippet of code from the program is basically:
         reg_expression<char> expression(">(.*?)<([/\\!]|[[:alnum:]])");
         match_results<string::iterator> Found;
         string::iterator itEnd((string::iterator)strInput.end());
         string::iterator itPos((string::iterator)strInput.begin());
         unsigned int flags = match_default;

         while (regex_search(itPos, itEnd, Found, expression, flags)) {
                  //...
                  itPos = Found[0].second;
         }

Thanks for any help you can give me

--
Gavin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk