1
votes

I am trying to compile version 1.57 of boost's spirit using Visual Studio 2013 update 4. The following simple program yields many errors and warnings.

#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
int main()
{return 0;}

What is going on?

The compiler command line has the following options:

/GS /W3 /Zc:wchar_t /Zi /Gm /Od /sdl /Fd"x64\Debug\vc120.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_LIB" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MTd /Fa"x64\Debug\" /EHsc /nologo /Za /Fo"x64\Debug\" /Fp"x64\Debug\Grammar.pch"

The most common warnings are

Warning 1 warning C4180: qualifier applied to function type has no meaning; ignored X:.libraries\boost\boost\proto\transform\detail\preprocessed\pass_through_impl.hpp 40 1 Grammar

and

Warning 79 warning C4224: nonstandard extension used : formal parameter 'expr' was previously defined as a type X:.libraries\boost\boost\proto\debug.hpp 126 1 Grammar

Some of the errors are:

Error 195 error C2146: syntax error : missing ',' before identifier 'expr_param' X:.libraries\boost\boost\proto\transform\arg.hpp 179 1 Grammar Error 196 error C2065: 'expr_param' : undeclared identifier X:.libraries\boost\boost\proto\transform\arg.hpp 179 1 Grammar Error 197 error C2977: 'boost::proto::result_of::value' : too many template arguments X:.libraries\boost\boost\proto\transform\arg.hpp 179 1 Grammar Error 198 error C2955: 'boost::proto::result_of::value' : use of class template requires template argument list X:.libraries\boost\boost\proto\transform\arg.hpp 179 1 Grammar Error 199 error C2061: syntax error : identifier 'expr_param' X:.libraries\boost\boost\proto\transform\arg.hpp 182 1 Grammar Error 200 error C2061: syntax error : identifier 'expr_param' X:.libraries\boost\boost\proto\transform\detail\preprocessed\make.hpp 69 1 Grammar Error 201 error C2061: syntax error : identifier 'expr_param' X:.libraries\boost\boost\proto\transform\when.hpp 73 1 Grammar Error 202 error C2146: syntax error : missing ';' before identifier 'type' X:.libraries\boost\boost\proto\detail\preprocessed\poly_function_funop.hpp 14 1 Grammar Error 203 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int X:.libraries\boost\boost\proto\detail\preprocessed\poly_function_funop.hpp 14 1 Grammar Error 204 error C2039: 'type' : is not a member of 'boost::tr1_result_of (Env)>' X:.libraries\boost\boost\proto\transform\env.hpp 367 1 Grammar Error 205 error C2504: 'type' : base class undefined X:.libraries\boost\boost\proto\transform\env.hpp 368 1 Grammar Error 206 error C2039: 'value' : is not a member of 'boost::proto::result_of::has_env_var' X:.libraries\boost\boost\proto\transform\when.hpp 189 1 Grammar Error 207 error C2975: 'C' : invalid template argument for 'boost::mpl::eval_if_c', expected compile-time constant expression X:.libraries\boost\boost\proto\transform\when.hpp 192 1 Grammar Error 208 error C2039: 'type' : is not a member of 'boost::mpl::eval_if_c,boost::proto::result_of::env_var>' X:.libraries\boost\boost\proto\transform\when.hpp 192 1 Grammar Error 209 error C2146: syntax error : missing ',' before identifier 'type' X:.libraries\boost\boost\proto\transform\when.hpp 193 1 Grammar Error 210 error C2065: 'type' : undeclared identifier X:.libraries\boost\boost\proto\transform\when.hpp 193 1 Grammar Error 211 error C2977: 'boost::remove_reference' : too many template arguments X:.libraries\boost\boost\proto\transform\when.hpp 193 1 Grammar Error 212 error C2955: 'boost::remove_reference' : use of class template requires template argument list X:.libraries\boost\boost\proto\transform\when.hpp 193 1 Grammar Error 213 error C1903: unable to recover from previous error(s); stopping compilation X:.libraries\boost\boost\proto\transform\when.hpp 194 1 Grammar

1
What is the first warning / error?Bill Lynch
Also, perhaps a duplicate of stackoverflow.com/questions/27126177/…Bill Lynch
@BillLynch: warning C4180: qualifier applied to function type has no meaningHector
I tried adding #define BOOST_RESULT_OF_USE_TR1 and #define _SCL_SECURE_NO_WARNINGS at the beginning but no luck.Hector

1 Answers

0
votes

Try using

#define BOOST_SPIRIT_USE_PHOENIX_V3

and one of

#define BOOST_RESULT_OF_USE_DECLTYPE // or
#define BOOST_RESULT_OF_USE_TR1 // or
#define BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK

Note It's crucial to define these before first inclusion of any boost header. This includes any stdafx.h if you have one

If any of the combinations result in success, report the bug at the spirit-general mailing list or Boost Trac. It could well be a missing/inappropriate compiler feature detection thing (I'm wondering about constexpr, or other features where MSVC might be starting support for things)