|
Boost Users : |
Subject: Re: [Boost-users] Problem using Boost regex
From: John Emmas (johne53_at_[hidden])
Date: 2009-12-08 02:51:05
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 <stdio.h>
#include <conio.h>
#include <string>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
bool validate_card_format(const string s)
{
static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
return regex_match(s, e);
}
int _tmain(int argc, _TCHAR* argv[])
{
bool bb = validate_card_format("1111 2222 3333 4444");
if (bb)
puts("Card format is valid - press any key to exit");
else
puts("Card format is invalid - press any key to exit");
getch();
return 0;
}
That's the entire code, in case you want to reproduce the problem. This
also gave me the same problem as yesterday (i.e. the Release build runs
fine, but not the Debug build). After a few experiments I found that it
comes down to the following project setting:-
Properties->C/C++->Code Generation->Runtime Library
If the Debug version is set to "Multi-threaded Debug", boost links to
libboost-regex-vc80-mt-sgd-1_40.lib and the app runs fine. OTOH if I leave
that setting at its default value ("Multi-threaded Debug DLL") boost links
to libboost-regex-vc80-mt-gd-1_40.lib and the app won't run.
Armed with this information I went back to yesterday's project and tried the
same change. Unfortunately, that's a much more complex project and it won't
link in Multi-threaded Debug mode (I get lots of errors about duplicated
symbols). However, I hope that might help you to make sense of the problem.
John
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net