Boost::lexical_cast, std::string, libCore.lib

Are there some restrictions on how one can use boost with root? I notice that if I link with libCore.lib than

string s = "1"; //int i = boost::lexical_cast<int>(s.c_str()); int j = boost::lexical_cast<int>(s);

the commented out line works, but the int j = … line results in a bad cast exception. If I do not link in libCore.lib all works fine.

I am using root v5.12/00. This was on Windows 2000 using Visual Studio 2005 (VS8). I have attached the solution file to this post.

Thanks,
Sanjeev
tick.cpp (553 Bytes)
root.zip (102 KB)

Hi,

does your build setting match your ROOT distribution? You’ll have to link against a ROOT debug distribution to build your code in debug mode, and ROOT release to build your code in release mode. Otherwise there’s a mismatch between the standard library implementations, which could trigger what you are seeing.

Cheers, Axel.

Hi Axel,

Thanks. That was the problem. When I link in Release mode all works fine.

Regards,
Sanjeev