FW: Linker errors when using regex Lib with MSVC8 and STLPort 5.1.0 and Boost 1_33_1
Hi I have built the StlPort 5.1.0 shared dlls and boost 1_33_1 Shared dlls successfully. The Platform is MSVC8. I created a sample projeth with just on file with code: #include <boost/regex.hpp> bool testregex( const char* StringToMatch ) { return( boost::regex_match( StringToMatch, boost::regex("[A-Z]+") )); } int main (int argc, char *argv[]) { bool trial = testregex( "hello how r u ?"); return 1; } Compilation succeeds but I get two Linker errors (BOOST_DYN_LINK is defined) Main.obj : error LNK2001: unresolved external symbol "public: bool __thiscall boost::re_detail::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> >
::match(void)" (?match@?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_std @@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost @@QAE_NXZ)
::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >(char const *,char const *,class boost::match_results<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags,char const *)" (??0?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_std@@U? $regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QA E@PBD0AAV?$match_results@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_s
1>Main.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::re_detail::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > td@@@2@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@ boost@@@2@W4_match_flags@regex_constants@2@0@Z) So it cannot find the constructor for perl_matcher and the declaration for regex_match. I found a similar post on Boost : http://www.nabble.com/-regex-Using-regex-in-x64-exe-with-VC-8.0-t2088061 .html#a5755051 The suggested solutions on this post are: 1) check for intermixing of x86 and x64 : I am on 32 bit platform.. so intermixing does not apply 2) add regex source code and compile ( using BOOST_REGEX_NO_LIB) : I get the errors for stdext namespace 1>C:\boost_1_33_1\boost/regex/v4/regex_workaround.hpp(145) : error C2653: 'stdext' : is not a class or namespace name 1> C:\boost_1_33_1\boost/regex/v4/regex_format.hpp(562) : see reference to function template instantiation 'OutputIterator boost::re_detail::copy<const charT*,OutputIterator>(InputIterator,InputIterator,OutputIterator)' being compiled 1> with 1> [ 1> OutputIterator=boost::re_detail::string_out_iterator<stlp_std::basic_str ing<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std::allocator<wchar_t>>
,
1> charT=wchar_t, 1> InputIterator=const wchar_t * 1> ] 1> C:\boost_1_33_1\boost/regex/v4/match_results.hpp(160) : see reference to function template instantiation 'OutputIterator boost::re_detail::regex_format_imp<boost::re_detail::string_out_iterator <S>,const wchar_t*,stlp_std::allocator<_Tp>,_CharT,boost::re_detail::trivial_forma t_traits<charT>>(OutputIterator,const boost::match_results<BidiIterator> &,const charT *,const charT *,boost::regex_constants::match_flag_type,const traits &)' being compiled 1> with 1> [ 1> OutputIterator=boost::re_detail::string_out_iterator<stlp_std::basic_str ing<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std::allocator<wchar_t>>
,
1> S=stlp_std::basic_string<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std ::allocator<wchar_t>>, 1> _Tp=boost::sub_match<const wchar_t *>, 1> _CharT=wchar_t, 1> charT=wchar_t, 1> BidiIterator=const wchar_t *, 1> traits=boost::re_detail::trivial_format_traits<wchar_t> 1> ] 1> C:\boost_1_33_1\boost/regex/v4/match_results.hpp(156) : while compiling class template member function 'stlp_std::basic_string<_CharT,_Traits,_Alloc> boost::match_results<BidiIterator>::format(const stlp_std::basic_string<_CharT,_Traits,_Alloc> &,boost::regex_constants::match_flag_type) const' 1> with 1> [ 1> _CharT=wchar_t, 1> _Traits=stlp_std::char_traits<wchar_t>, 1> _Alloc=stlp_std::allocator<wchar_t>, 1> BidiIterator=const wchar_t * 1> ] 1> C:\boost_1_33_1\boost/regex/v4/instances.hpp(86) : see reference to class template instantiation 'boost::match_results<BidiIterator>' being compiled 1> with 1> [ 1> BidiIterator=const wchar_t * 1> ] 1>C:\boost_1_33_1\boost/regex/v4/regex_workaround.hpp(145) : error C3861: 'unchecked_copy': identifier not found Can anyone suggest a solution?? Thanks in advance Manish Mangal Software Engineer atlas(r) search Partner for Results 206-816-8349 // phone Manish.Mangal@AtlasSolutions.com <mailto:t-Matt.Koch@AtlasSolutions.com> // email www.AtlasSolutions.com <outbind://116-000000001368D4B5F8F6D0488191444C76FD7C9507008921F4CB773B0 545AAED425DEF553BC300003A3500100000DB0C51F64BED3447AA6EC585072C4EC300000 1E3B7A70000/jenniferh/Local%20Settings/Temporary%20Internet%20Files/OLK3 /www.AtlasSolutions.com> // web
Manish Mangal wrote:
Hi
I have built the StlPort 5.1.0 shared dlls and boost 1_33_1 Shared dlls successfully.
The Platform is MSVC8.
I created a sample projeth with just on file with code:
Compilation succeeds but I get two Linker errors (BOOST_DYN_LINK is defined)
Those are typically the errors you get when linking against Boost libraries that were *not* also built against STLport.
2) add regex source code and compile ( using BOOST_REGEX_NO_LIB) : I get the errors for stdext namespace
1>C:\boost_1_33_1\boost/regex/v4/regex_workaround.hpp(145) : error C2653: 'stdext' : is not a class or namespace name
That's very strange: that section of code is protected with: #if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(_CPPLIB_VER) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) So should never be taken when STLport is in use. I'm not able to reproduce this either using STLport 5.1 and VC8. What specific compiler options are you using and which file generated this error? Thanks, John.
Manish Mangal wrote:
2) add regex source code and compile ( using BOOST_REGEX_NO_LIB) : I get the errors for stdext namespace
I looked again, and apparently this was a bug in 1.33.1 that's been fixed in cvs, try downloading the latest version of regex_workarounds.hpp from here: http://boost.cvs.sourceforge.net/boost/boost/boost/regex/v4/regex_workaround... and see if that fixes things. John.
Hi John Thanks for the replies. Sorry I was out of Office and did not respond. I got past the stdext namespace errors. Can you please look at this post of mine. I can get the release versions working but not the debug.. I am pretty sure I have build debug versions of Boost with stlport. http://www.nabble.com/Link-errors-with-boost-regex-1_33_1%2C-Stlport-5.0-and... Mangal wrote:
Hi
I have built the StlPort 5.1.0 shared dlls and boost 1_33_1 Shared dlls successfully.
The Platform is MSVC8.
I created a sample projeth with just on file with code:
#include <boost/regex.hpp>
bool testregex( const char* StringToMatch )
{
return( boost::regex_match( StringToMatch, boost::regex("[A-Z]+") ));
}
int main (int argc, char *argv[])
{
bool trial = testregex( "hello how r u ?");
return 1;
}
Compilation succeeds but I get two Linker errors (BOOST_DYN_LINK is defined)
Main.obj : error LNK2001: unresolved external symbol "public: bool __thiscall boost::re_detail::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> >
::match(void)" (?match@?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_std @@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost @@QAE_NXZ)
::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >(char const *,char const *,class boost::match_results<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags,char const *)" (??0?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_std@@U? $regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QA E@PBD0AAV?$match_results@PBDV?$allocator@U?$sub_match@PBD@boost@@@stlp_s
1>Main.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::re_detail::perl_matcher<char const *,class stlp_std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > td@@@2@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@ boost@@@2@W4_match_flags@regex_constants@2@0@Z)
So it cannot find the constructor for perl_matcher and the declaration for regex_match.
I found a similar post on Boost : http://www.nabble.com/-regex-Using-regex-in-x64-exe-with-VC-8.0-t2088061 .html#a5755051
The suggested solutions on this post are:
1) check for intermixing of x86 and x64 : I am on 32 bit platform.. so intermixing does not apply
2) add regex source code and compile ( using BOOST_REGEX_NO_LIB) : I get the errors for stdext namespace
1>C:\boost_1_33_1\boost/regex/v4/regex_workaround.hpp(145) : error C2653: 'stdext' : is not a class or namespace name
1> C:\boost_1_33_1\boost/regex/v4/regex_format.hpp(562) : see reference to function template instantiation 'OutputIterator boost::re_detail::copy<const charT*,OutputIterator>(InputIterator,InputIterator,OutputIterator)' being compiled
1> with
1> [
1> OutputIterator=boost::re_detail::string_out_iterator<stlp_std::basic_str ing<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std::allocator<wchar_t>>
,
1> charT=wchar_t,
1> InputIterator=const wchar_t *
1> ]
1> C:\boost_1_33_1\boost/regex/v4/match_results.hpp(160) : see reference to function template instantiation 'OutputIterator boost::re_detail::regex_format_imp<boost::re_detail::string_out_iterator <S>,const wchar_t*,stlp_std::allocator<_Tp>,_CharT,boost::re_detail::trivial_forma t_traits<charT>>(OutputIterator,const boost::match_results<BidiIterator> &,const charT *,const charT *,boost::regex_constants::match_flag_type,const traits &)' being compiled
1> with
1> [
1> OutputIterator=boost::re_detail::string_out_iterator<stlp_std::basic_str ing<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std::allocator<wchar_t>>
,
1> S=stlp_std::basic_string<wchar_t,stlp_std::char_traits<wchar_t>,stlp_std ::allocator<wchar_t>>,
1> _Tp=boost::sub_match<const wchar_t *>,
1> _CharT=wchar_t,
1> charT=wchar_t,
1> BidiIterator=const wchar_t *,
1> traits=boost::re_detail::trivial_format_traits<wchar_t>
1> ]
1> C:\boost_1_33_1\boost/regex/v4/match_results.hpp(156) : while compiling class template member function 'stlp_std::basic_string<_CharT,_Traits,_Alloc> boost::match_results<BidiIterator>::format(const stlp_std::basic_string<_CharT,_Traits,_Alloc> &,boost::regex_constants::match_flag_type) const'
1> with
1> [
1> _CharT=wchar_t,
1> _Traits=stlp_std::char_traits<wchar_t>,
1> _Alloc=stlp_std::allocator<wchar_t>,
1> BidiIterator=const wchar_t *
1> ]
1> C:\boost_1_33_1\boost/regex/v4/instances.hpp(86) : see reference to class template instantiation 'boost::match_results<BidiIterator>' being compiled
1> with
1> [
1> BidiIterator=const wchar_t *
1> ]
1>C:\boost_1_33_1\boost/regex/v4/regex_workaround.hpp(145) : error C3861: 'unchecked_copy': identifier not found
Can anyone suggest a solution??
Thanks in advance
Manish Mangal
Software Engineer
atlas(r) search Partner for Results
206-816-8349 // phone
Manish.Mangal@AtlasSolutions.com <mailto:t-Matt.Koch@AtlasSolutions.com> // email www.AtlasSolutions.com <outbind://116-000000001368D4B5F8F6D0488191444C76FD7C9507008921F4CB773B0 545AAED425DEF553BC300003A3500100000DB0C51F64BED3447AA6EC585072C4EC300000 1E3B7A70000/jenniferh/Local%20Settings/Temporary%20Internet%20Files/OLK3 /www.AtlasSolutions.com> // web
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/FW%3A-Linker-errors-when-using-regex-Lib-with-MSVC8-an... Sent from the Boost - Users mailing list archive at Nabble.com.
Mangal wrote:
I got past the stdext namespace errors. Can you please look at this post of mine.
I can get the release versions working but not the debug.. I am pretty sure I have build debug versions of Boost with stlport.
http://www.nabble.com/Link-errors-with-boost-regex-1_33_1%2C-Stlport-5.0-and...
Assuming you're certain that the regex lib was built with STLPort, try double checking that __STL_DEBUG is defined consistently between your app and the lib. Basically you need to ensure that regex and your app are built with identical options - and because STLPort introduces so many new possible build variants - that's why building regex from your IDE and manually checking that all the options are the same is often the path of least resistance. HTH, John.
Thanks John. This may not be the best place to post this question. When trying to build regex in the IDE( Visual studio 2005) the import library for the dll is not being created. I have checked in the IDE settings that import library name should be overriden to the name that I want. Any help is appreciated. Thanks John Maddock wrote:
Mangal wrote:
I got past the stdext namespace errors. Can you please look at this post of mine.
I can get the release versions working but not the debug.. I am pretty sure I have build debug versions of Boost with stlport.
http://www.nabble.com/Link-errors-with-boost-regex-1_33_1%2C-Stlport-5.0-and...
Assuming you're certain that the regex lib was built with STLPort, try double checking that __STL_DEBUG is defined consistently between your app and the lib. Basically you need to ensure that regex and your app are built with identical options - and because STLPort introduces so many new possible build variants - that's why building regex from your IDE and manually checking that all the options are the same is often the path of least resistance.
HTH, John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/FW%3A-Linker-errors-when-using-regex-Lib-with-MSVC8-an... Sent from the Boost - Users mailing list archive at Nabble.com.
Mangal wrote:
Thanks John.
This may not be the best place to post this question. When trying to build regex in the IDE( Visual studio 2005) the import library for the dll is not being created. I have checked in the IDE settings that import library name should be overriden to the name that I want. Any help is appreciated.
That happens if no symbols are exported from the dll: make sure BOOST_REGEX_DYN_LINK is defined when building as a dll (and in the app that will be linking to it as well). BTW, unless you really need a dll (calling the regex lib from multiple dll's for example) you will get smaller code size from static linking. John.
Thanks John That solved my problem... John Maddock wrote:
Mangal wrote:
Thanks John.
This may not be the best place to post this question. When trying to build regex in the IDE( Visual studio 2005) the import library for the dll is not being created. I have checked in the IDE settings that import library name should be overriden to the name that I want. Any help is appreciated.
That happens if no symbols are exported from the dll: make sure BOOST_REGEX_DYN_LINK is defined when building as a dll (and in the app that will be linking to it as well).
BTW, unless you really need a dll (calling the regex lib from multiple dll's for example) you will get smaller code size from static linking.
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/FW%3A-Linker-errors-when-using-regex-Lib-with-MSVC8-an... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
John Maddock
-
Mangal
-
Manish Mangal