linking problem with Visual Studio 2005
Hi everybody, I'm trying to use boost in a .NET project written in C++ managed. When I build it in Debug version it's everything alright, but when I do it in Release version I've got this error: error LNK2001: unresolved external symbol "char __cdecl boost::re_detail::w32_toupper(char,unsigned long)" (?w32_toupper@ re_detail@boost@@$$FYADDK@Z). In particular the error above is generated by the following row: regex_replace(std::string(p1, p2), transformer, replace_string,boost::format_all). So now I'm in a bind because I've completed my application but I cannot distribute it due to the fact that .NET allows to deliver only release version. Can some help me? Cheers
Andrea Galeazzi wrote:
Hi everybody, I'm trying to use boost in a .NET project written in C++ managed. When I build it in Debug version it's everything alright, but when I do it in Release version I've got this error: error LNK2001: unresolved external symbol "char __cdecl boost::re_detail::w32_toupper(char,unsigned long)" (?w32_toupper@ re_detail@boost@@$$FYADDK@Z). In particular the error above is generated by the following row: regex_replace(std::string(p1, p2), transformer, replace_string,boost::format_all). So now I'm in a bind because I've completed my application but I cannot distribute it due to the fact that .NET allows to deliver only release version. Can some help me?
Well we can try, but I've not seen that one before: "w32_toupper" is fully defined in w32_regex_traits.cpp so this shouldn't be a problem. How did you build the regex lib: as a native code library using bjam or as a managed code library? And just double checking the obvious, I hope you don't have either BOOST_ALL_NO_LIB or BOOST_REGEX_NO_LIB defined when building, or if you do that your project references the regex lib in some way? If you're in a rush, then one quick thing you could try is: * Add the #define BOOST_REGEX_NO_LIB to your project settings (so the auto-linking code is disabled). * Add the regex source code directly to your application (it's libs/regex/src/*.cpp) Then try rebuilding, if that works but bloats your application (does the .NET linker automatically remove unused code?), then try building regex as a managed code static library from within your IDE, and then add that project as a dependency to your app. I suspect that the original issue is caused by some weird build-settings interaction, but it might be hard to track down by anything except trial and error. Do let me know if you find the cause though, and I'll fix it if it's possible. Unless anyone else has seen this before...? HTH, John.
2007/12/18, John Maddock
Andrea Galeazzi wrote:
Hi everybody, I'm trying to use boost in a .NET project written in C++ managed. When I build it in Debug version it's everything alright, but when I do it in Release version I've got this error: error LNK2001: unresolved external symbol "char __cdecl boost::re_detail::w32_toupper(char,unsigned long)" (?w32_toupper@ re_detail@boost@@$$FYADDK@Z). In particular the error above is generated by the following row: regex_replace(std::string(p1, p2), transformer, replace_string,boost::format_all). So now I'm in a bind because I've completed my application but I cannot distribute it due to the fact that .NET allows to deliver only release version. Can some help me?
Well we can try, but I've not seen that one before: "w32_toupper" is fully defined in w32_regex_traits.cpp so this shouldn't be a problem.
How did you build the regex lib: as a native code library using bjam or as a managed code library? And just double checking the obvious, I hope you don't have either BOOST_ALL_NO_LIB or BOOST_REGEX_NO_LIB defined when building, or if you do that your project references the regex lib in some way?
If you're in a rush, then one quick thing you could try is:
* Add the #define BOOST_REGEX_NO_LIB to your project settings (so the auto-linking code is disabled). * Add the regex source code directly to your application (it's libs/regex/src/*.cpp)
Then try rebuilding, if that works but bloats your application (does the .NET linker automatically remove unused code?), then try building regex as a managed code static library from within your IDE, and then add that project as a dependency to your app.
I suspect that the original issue is caused by some weird build-settings interaction, but it might be hard to track down by anything except trial and error. Do let me know if you find the cause though, and I'll fix it if it's possible.
Unless anyone else has seen this before...?
HTH, John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks John, I followed your advise and now it works fine! The only bad thing is that I must compile regex source in my own projects.
How did you build the regex lib: as a native code library using bjam or as a managed code library? I use it as native code. If you wanna go deeper into the problem you have just create a new CLR C++ Console Project with the following code:
int main(array
participants (2)
-
Andrea Galeazzi
-
John Maddock