[regex] Unresolved external symbols under VC7.1 w/ dynamic linking
Hello,
when I define the symbol BOOST_DYN_LINK (in my project settings) I get
the following linker errors in MSVC 7.1:
FilterDlg.obj : error LNK2001: unresolved external symbol "wchar_t * boost::re_detail::wide_lower_case_map" (?wide_lower_case_map@re_detail@boost@@3PA_WA)
FilterDlg.obj : error LNK2001: unresolved external symbol "private: static unsigned short * boost::w32_regex_traits
when I define the symbol BOOST_DYN_LINK (in my project settings) I get the following linker errors in MSVC 7.1:
FilterDlg.obj : error LNK2001: unresolved external symbol "wchar_t * boost::re_detail::wide_lower_case_map" (?wide_lower_case_map@re_detail@boost@@3PA_WA) FilterDlg.obj : error LNK2001: unresolved external symbol "private: static unsigned short * boost::w32_regex_traits
::wide_unicode_classes" (?wide_unicode_classes@?$w32_regex_traits@_W@boost@@0PAGA) When linking Boost.Regex statically, everything is ok. I am using /Zc:wchar_t ("Treat wchar_t as Built-in type") in my project settings.
Any ideas what's going wrong?
Not really: I've checked and those symbols are exported, and your setup is one we regularly test. Are you able to produce a short test case? Thanks, John.
John Maddock
when I define the symbol BOOST_DYN_LINK (in my project settings) I get the following linker errors in MSVC 7.1:
[snip]
When linking Boost.Regex statically, everything is ok. I am using /Zc:wchar_t ("Treat wchar_t as Built-in type") in my project settings.
Any ideas what's going wrong?
Not really: I've checked and those symbols are exported, and your setup is one we regularly test. Are you able to produce a short test case?
Yes. I am not familiar with Boost.Test, so I just wrote a small test program:
<code>
// Boost includes -------------------------------------------------------------
#define BOOST_DYN_LINK
#include
Thanks,
John.
Thank you. Klaus
#define BOOST_DYN_LINK
OK, that's the problem: BOOST_DYN_LINK is an internal Boost macro that instructs the auto-linking code to link to a dll, but it doesn't tell the code to add __declspec(dllimport) where needed. You should be defining one of: BOOST_ALL_DYN_LINK: make all Boost libs link as dll's. BOOST_REGEX_DYN_LINK: make regex only link as a dll.
My project settings are: - Runtime Lib: Multithreaded-DLL (/MD)
Be careful not to mix /MD with /D_DEBUG, it confuses the auto-link code (not really a Boost issue, it affects any libray that's linked with #pragma comment). HTH, John.
John Maddock
#define BOOST_DYN_LINK
OK, that's the problem: BOOST_DYN_LINK is an internal Boost macro [snip] You should be defining one of:
BOOST_ALL_DYN_LINK: make all Boost libs link as dll's. BOOST_REGEX_DYN_LINK: make regex only link as a dll.
D'oh! Thank you.
Be careful not to mix /MD with /D_DEBUG, it confuses the auto-link code (not really a Boost issue, it affects any libray that's linked with #pragma comment).
Yes, I was assuming a release build.
HTH,
It did, thanks.
John.
-- Klaus
participants (2)
-
John Maddock
-
Klaus Nowikow