Re: [Boost-users] Problem using Boost regex

[Addendum...] Following my original post, firstly, apologies - I should have mentioned that I'm trying to build the regex example using Visual Studio 8 Express Edition (i.e. VC++2005). Also, I've got some more information.... Apart from those libs that I mentioned in my original post, I've found a whole bunch of libs beginning with "libboost-regex-vc80-" and ending with these suffixes:- mt-1_40.lib mt-gd-1_40.lib mt-s-1_40.lib mt-sgd-1_40.lib s-1_40.lib I guess these must be the static link libs. Anyway, I've discovered that if I link to any lib that ends in "mt-1_40.lib" I can build my app and launch it successfully as long as I build in Release mode. But in Debug mode, the app either doesn't launch - or if it does launch, it gives the unhandled exception that I described earlier. Hope that helps, John

Here's the thing, with VC++ you absolutely must link to the library variant that was built with the exactly the same runtime options as your code - that's why there are so many VC++ binaries supplied. If you don't do that then your code will crash. Now for the good news: Boost.Regex will automatically select the correct library variant to link against, you don't need to do anything, and you shouldn't explicitly link against any of those libraries. Just make sure that the directory containing the libraries is in your library search path (under properties->linker->Additional Library Directories). HTH, John.

----- Original Message -----
From: "John Maddock"
Wow, how clever!! I removed the explicit linking and added the search path to both Debug and Release configs (in my case, the path is 'E:\boost_1_40\lib' for all libraries). The Release build still builds and runs fine. But when I try to launch the Debug build I get a dialog box with this message:- " Unable to start program 'F:\MSVCtest_app\debug\MSVCtest_app.exe' This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. " FWIW I only seem to have these two (boost_regex) DLLs:- boost_regex-vc80-mt-1_40.dll and boost_regex-vc80-mt-gd-1_40.dll but my app's manifest file (for the Debug version) specifies "Microsoft.VC80.DebugCRT". Is one of those DLL's a CRT-debug DLL or am I missing something? Thanks, John

Yes the -gd version is the debug build... but the default behavior for Boost.Regex is to static link, so it shouldn't be looking for any regex dll at all (unless you explicitly defined BOOST_REGEX_DYN_LINK when building your app). So my best guess at present is that this is a VC++ installation issue... does building and running a "hello world" app in debug mode work? Apologies if this is a stupid suggestion... John.

----- Original Message ----- From: "John Maddock"
The short answer is "yes", John. If I comment out the line that ends up needing regex - i.e. // bool bb = validate_card_format("1111 2222 3333 4444"); then the app builds and runs fine in either mode. In fact I've been working on this app for around 7 weeks and it only went wrong after I added those (fairly minor) regex additions. Having said that, this isn't a simple Windows app because I'm using gtk-win32 (rather than MFC) to provide the GUI. It's getting a bit late here (UK time) and I'm a bit too tired to keep working but first thng tomorrow, I'll build a very simple console app and see if I get the same problem. Thanks for your suggestions. In the meantime (just out of curiosity) what is the significance of the letter "g" in:- libboost_regex-vc80-mt-gd-1_40.lib I would have guessed at the equivalent Debug lib being called:- libboost_regex-vc80-mt-d-1_40.lib or libboost_regex-vc80-mtd-1_40.lib John BTW - No.... BOOST_REGEX_DYN_LINK isn't defined and if I "hide" the DLLs, the Release build still runs okay - so it must be linking statically.


Hi John, I have some new information this morning. I got up early and
created a simple console app using the App Wizard (Visual Studio 8 Express
Edition). Into the main source file (test_proj.cpp) I typed this code:-
#include "stdafx.h"
#include

Nope, I confess to not understand manifests at all (does anyone?). In any case that configuration is basically how we run our regression tests - so it certainly should work - and your test case works OK for me here. The only thing I can suggest is that since the regex lib is "just a bunch of source files" that you either: rebuild the libraries yourself: follow the getting started guide at http://www.boost.org/doc/libs/1_41_0/more/getting_started/index.html but basically you want to invoke: bjam --with-regex --build-type=complete stage which will put all the regex binaries in stage/lib. Or... add the source files in libs/regex/src/*.cpp directly to your project, and then add the #define BOOST_REGEX_NO_LIB to your project settings and rebuild. HTH, John.

John - one other thing.... could you tell me the date, time and size of your copy of msvcrtd.lib (and msvcrtd.dll) ? Thanks.

Nothing to do with bjam: that would be the Visual C++ command line tool not being configured correctly - try adding the include path to the Windows SDK headers to your vcvars32.bat file, you might have to update the library search path in there as well. Or... it might just be easier to add the regex source file directly to your project? John.

----- Original Message -----
From: "John Maddock"
Okay, I just got around to doing that. AFAICT bjam actually calls'VC\vcvarsall.bat', passing it the parameter "x86". This in turn, calls 'VC\bin\vcvars32.bat'. Unfortunately, bjam directs the output of that call to nul - so I can't tell whether vcvars.bat is executing correctly. But I assume not, because I still get the error 'Cannot open windows.h'. How do I stop bjam from directing the batch file output to nul? John

----- Original Message -----
From: "John Maddock"
Nope, I confess to not understand manifests at all (does anyone?).
The short answer is "No!" It just seems to be DLL Hell re-introduced all over again. You'd have thought that Microsoft might have learned something from the last experience. What's that saying about those who don't learn from the lessons of history...? Nevertheless John, you gave me something to think about - so please hold fire on this one for a moment. According to C:\Windows\WinSxS\Manifests I have two CRT runtime versions installed for Release mode apps:- 8.0.50727.4053 (this is the one currently used by Boost) - and 8.0.50727.42 But for DebugCRT's I only have one installed:- 8.0.50727.42 I'm guessing that 8.0.50727.42 must be EARLIER than 8.0.50727.4053 - and that's why my app will run in Release mode but not in Debug mode. Give me some time to check this out. Off-topic, but as an aside... when I post to this mailing list I get an acknowledgement back but I don't get my own email back. This makes it (slightly) inconvenient if someone wants to correct (or add to) something they just said in a previous post. Has anyone thought about sending back the poster's own email? Most other mailing lists work that way. Cheers, John

Do you have Microsoft update configured (as opposed to Windows update)? There have been quite a few updates/patches to VC++. I just downloaded a tool called Manifest View from http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx. This gives me for example: assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" Looks to be a good way to check which msvc version has been requested by the application.
Works like that for me. There's a setting you can set/adjust on the mailing list preferences page for this, but also some mail providers are known to filter out your own messages (gmail is the prime culprit). HTH, John.

----- Original Message -----
From: "John Maddock"
Do you have Microsoft update configured (as opposed to Windows update)? There have been quite a few updates/patches to VC++.
I've just updated to the latest service pack for Visual Studio 8 Express. And although it took my DebugCRT up a notch, it only took me to 8.0.50727.762. I still don't have the same version as you (8.0.50727.4053). I'm guessing that you must be using the full edition John (i.e. not the free, Express Edition). Is that correct? If so, there's no way that I can make this work by upgrading Visual Studio Express. I'll have to follow one of your other suggestions. Thanks for all your patience.
Forgive my ignorance -but how do I get to that preferences page? I just went to the site http://lists.boost.org/mailman/listinfo.cgi/boost-users but all I could see were options for subscribing, unsubscribing or viewing the list of subscribers. John

Thanks Steven. I didn't read past the bit that said "unsubscribe" !!

The .4053 versions were added with the "Security Update for MS Visual Studio 2005 Service Pack 1" update (KB971090, KB973923, and KB973673). These only fix a minor security issue related to ATL packages. 762 is the previous version which has been around for quite a while. You can build EXEs using 762 and it will load a 4053 DLL just fine, but not the other way. I have no idea if the Express edition is limited to 762, but it seems unlikely, yet sadly possible. -- Bill --
participants (4)
-
Bill Buklis
-
John Emmas
-
John Maddock
-
Steven Watanabe