regex - linking problem

Dear All, I have a problem linking with regex that I couldn't resolve - would greatly appreciate if anyone could give me a hint. I followed the discussion threads regarding similar problems and got forward with resolving other issues, however this final single problem I could not resolve: error LNK2001: unresolved external symbol "void __cdecl boost::re_detail::raise_runtime_error(class _STL::runtime_error const &)" (?raise_runtime_error@re_detail@boost@@YAXABVruntime_error@_STL@@@Z) My environment: o Windows XP o Microsoft DevStudio - Visual C++ 6, Service pack 6 o I am building my DLL, which will use boost::regex as (an additional) DLL o My build flags - Multithreaded dll (more info is avail if needed) o I am using stlport (which is located on my environment under '...\VC98\Include\stlport\...') o I include <boost/regex.hpp> and using 'boost::wregex', 'boost::wcmatch', 'boost::regex_search', etc o I added the next to 'user.hpp': #define BOOST_REGEX_NO_W32 #define BOOST_REGEX_NO_LIB o I am adding boost library to my linking process with the next pragma statement: #ifdef _DEBUG #pragma comment(lib, "<...the path...>\\boost_regex-vc6-mt-gdp-1_33") #else #pragma comment(lib, "<...the path...>\\boost_regex-vc6-mt-p-1_33") #endif // _DEBUG boost::regex build: o I use BJame.exe to build boost o I call 'VCVars32.bat' before all o I set the next environment variables before calling BJam: * VISUALC=<..the path to 'VC98'...> * INCLUDE=%STLPORT_PATH%;%INCLUDE% o Build line: BJam.exe -a -sTOOLS=MSVC-STLPORT --with-regex ...after all this: the linker error (unresolved 'raise_runtime_error' as written above) M A N Y T H A N K S ! ! ! Paz _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

error LNK2001: unresolved external symbol "void __cdecl boost::re_detail::raise_runtime_error(class _STL::runtime_error const &)" (?raise_runtime_error@re_detail@boost@@YAXABVruntime_error@_STL@@@Z)
That can occur if you build the library with one set of options and use with another.
My environment: o Windows XP o Microsoft DevStudio - Visual C++ 6, Service pack 6 o I am building my DLL, which will use boost::regex as (an additional) DLL o My build flags - Multithreaded dll (more info is avail if needed) o I am using stlport (which is located on my environment under '...\VC98\Include\stlport\...') o I include <boost/regex.hpp> and using 'boost::wregex', 'boost::wcmatch', 'boost::regex_search', etc o I added the next to 'user.hpp': #define BOOST_REGEX_NO_W32 #define BOOST_REGEX_NO_LIB o I am adding boost library to my linking process with the next pragma statement: #ifdef _DEBUG #pragma comment(lib, "<...the path...>\\boost_regex-vc6-mt-gdp-1_33") #else #pragma comment(lib, "<...the path...>\\boost_regex-vc6-mt-p-1_33") #endif // _DEBUG
boost::regex build: o I use BJame.exe to build boost o I call 'VCVars32.bat' before all o I set the next environment variables before calling BJam: * VISUALC=<..the path to 'VC98'...> * INCLUDE=%STLPORT_PATH%;%INCLUDE% o Build line: BJam.exe -a -sTOOLS=MSVC-STLPORT --with-regex
...after all this: the linker error (unresolved 'raise_runtime_error' as written above)
Toolset names are case sensitive, that should be -sTOOLS=msvc-stlport. Also don't add STLport path to your INCLUDE variable, pass the right STLPORT_PATH to bjam instead (check the docs on the msvc-stlport toolset for more information and options: see the getting started docs). If you do the above then regex will auto-link to the right libraries without you having to specfy the names (which is error prone at best). If you modify your boost/regex/user.hpp then make sure you do this *before* you build the library. HTH, John.

Thanks for the quick response. Still no success, getting the same problem: UnsignedAnalysis.obj : error LNK2001: unresolved external symbol "void __cdecl boost::re_detail::raise_runtime_error(class _STL::runtime_error const &)" (?raise_runtime_error@re_detail@boost@@YAXABVruntime_error@_STL@@@Z) \MyProject\Bin\Debug/MyProject.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe. To make my first message more clear: a. I fully succeeded to build the 'boost-regex' libraries using bjam.exe b. The linker problem occurs to me when I try to build MY DLL (which includes regex headers and try to link with regex dynamic lib for using the DLL) >Toolset names are case sensitive, that should be -sTOOLS=msvc-stlport. Ok, done this. >Also don't add STLport path to your INCLUDE variable, pass the right >STLPORT_PATH to bjam instead (check the docs on the msvc-stlport toolset >for 1. Ok, do not modify INCLUDE anymore. 2. I pass the STLPORT_PATH by setting an environment variable by this name (I think this is the way?) It seems that this is working correctly as all regex libraries are built, and during the build process I can see that 'msvc-stlport' is being used. HOWEVER - as mentioned above - still the same problem... >If you do the above then regex will auto-link to the right libraries >without >you having to specfy the names (which is error prone at best). For some reason this is not working for me, if I try to use the auto-link I get the next error during compilation: warning: STLPort debug versions are built with /D_STLP_DEBUG=1 s:\...\auto_link.hpp(175) : fatal error C1189: #error : "Build options aren't compatible with pre-built libraries" However, I can live with this problem... Thanks for the help - Paz _________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

Thanks for the quick response. Still no success, getting the same problem:
UnsignedAnalysis.obj : error LNK2001: unresolved external symbol "void __cdecl boost::re_detail::raise_runtime_error(class _STL::runtime_error const &)" (?raise_runtime_error@re_detail@boost@@YAXABVruntime_error@_STL@@@Z) \MyProject\Bin\Debug/MyProject.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe.
Hmmm, that symbol is always in the library, the only thing I can think of at present is that the library build did not in fact have STLport in it's include path. Oh wait a minute, if this is a debug build you are defining __STL_DEBUG aren't you? The bjam built libs are always built with this defined, so the debug build of your app will need to be as well in order to link against them. HTH, John.

Thanks John,
__STL_DEBUG - the debug build of your app will need to be as well in order to link against them.
I found that _STLP_DEBUG is defined when boost is build. I tried to add this definition, but it caused other compilation errors in my DLL. My DLL is part of a system that uses stlport without this flag, thus this setting might not be trivial for me... Another thing - my release build also is refusing to link with the next error: UnsignedAnalysis.obj : error LNK2001: unresolved external symbol "void __fastcall boost::re_detail::raise_runtime_error(class _STL::runtime_error const &)" (?raise_runtime_error@re_detail@boost@@YIXABVruntime_error@_STL@@@Z) \Path/MyDll.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe. So maybe this linking problem is not only related to _STLP_DEBUG (?) Questions: o Is there a way I can UN-DEFINE this flag for the boost debug build (maybe in user.hpp?) o Is there a list of all the settings/definition I need to set in my application in order to link with boost? Thanks again - Paz _________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

John Smith wrote:
Questions: o Is there a way I can UN-DEFINE this flag for the boost debug build (maybe in user.hpp?)
bjam "-sBUILD=<runtime-build>release" ... -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Another thing - my release build also is refusing to link with the next error:
OK the simplest thing to do is probably to just build the regex lib from your IDE - it's just a bunch of sources so you can build it any way you like - just make sure that you use the same build options when you build the lib as you use for your app. John.

OK the simplest thing to do is probably to just build the regex lib from your IDE - it's just a bunch of sources so you can build it any way you like - just make sure that you use the same build options when you build the lib as you use for your app.
Great idea - looks like it is working now ! Many thanks - Paz _________________________________________________________________ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
participants (3)
-
John Maddock
-
John Smith
-
Rene Rivera