
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.