#include <boost/algorithm/string.hpp> produces Error      3      error C2059: syntax error : 'reinterpret_cast'      \boost\function\function_template.hpp      566      1

JPERKS1985
JPERKS1985 used Ask the Experts™
on
I'm trying to include the string.hpp boost file, when I do this I get the error,

error C2059: syntax error : 'reinterpret_cast'      \boost\function\function_template.hpp      566      

This line within function_template.hpp is,

        assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const
        {
         ERROR LINE -------> new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f);
        }

How can this be fixed? I'm using VS2010.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
evilrixSenior Software Engineer (Avast)

Commented:
Which version of boost?

Author

Commented:
1.47
evilrixSenior Software Engineer (Avast)

Commented:
So, I downloaded in installed the Windows version of Boost (I generally develop only on Linux ); the same version you have. I created a new project in Visual Studio 2010 and configured the include and library paths to point to where boost was installed (I took the default settings to install) and then created the follow small program.

#include <boost/algorithm/string.hpp>

int main()
{
   // nothing to see here
}

Open in new window


It built without error.

Are you sure you are building a native C++ application?

Author

Commented:
i thought i was but who knows. What do I need to select to ensure that it is a native application?
Senior Software Engineer (Avast)
Commented:
Make sure the /clr flag is not set.
http://msdn.microsoft.com/en-us/library/k8d11d4s.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial