Sven Van Echelpoel wrote:
I'm having a strange problem when I try to include boost::regex in my project (VC6.5 on Win2K). I'm not using Build to build a separate regex dll but rather include the source files directly in the project (or rather in a small utility static library). I've defined BOOST_REGEX_STATIC_LINK to avoid __declspec( dllimport ) / __declspec( dllexport ).
Are you sure that that's defined for all translation units that use or implement Boost.Regex?
Although everything compiles just fine the linker complains that it cannot find the library boost_regex_vc6_mdsd.lib. Further investigation revealed that it is actuallty listed somewhere as an additional default library (the linker outputs this when you switch on link progress messages). Searching through the sourcecode for #pragma comment( lib, ... ) and #pragma comment( linker, ... ) directives came up empty as did a search for boost_regex_vc6_mdsd.lib in all sources and headers.
It's in "boost/regex/v3/regex_library_include.hpp".
I got it to link by letting the linker ignore boost_regex_vc6_mdsd.lib. Even so I still would like to know where this is comming from. Any ideas?
I know I had some kind of problem with the above-mentioned header generated the wrong library name when I first started using Boost.Regex so I disabled the header by defining its guard macro before including "boost/regex.hpp". However, I removed that just now and didn't have any problems. Have you created your own project definition which uses a different library name? It's probably easier just to use the makefile (vc6.mak) in Visual Studio. You can do this by selecting "Insert Project into Workspace", selecting "vc6.mak" from the build directory, and thus creating a project that calls nmake on the makefile. Then you just need to edit the project settings to specify what the target names are for each configuration.