boost threadpool - c++

I'm trying to create a threadpool with the boost threadpool library, but on defining it I keep getting lots of error about template params being wrong.
I'm probably doing something fundamentally wrong, but I'm not seeing it?
//Threadpool
typedef boost::threadpool::thread_pool<
boost::threadpool::task_func,
boost::threadpool::fifo_scheduler<tsk>,
boost::threadpool::static_size<boost::threadpool::fifo_pool>,
boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
> pool;
ERRORS:
------ Build started: Project: Trial, Configuration: Debug Win32 ------
Compiling...
Trial.cpp
error C2923: 'boost::threadpool::fifo_scheduler' : 'tsk' is invalid as template argument '#1', type expected
see declaration of 'tsk'
error C3200: 'boost::threadpool::fifo_pool' : invalid template argument for template parameter 'SizePolicy', expected a class template
error C3200: 'boost::threadpool::resize_controller<Pool>' : invalid template argument for template parameter 'SizePolicyController', expected a class template
with
[
Pool=boost::threadpool::fifo_pool
]
error C3200: 'boost::threadpool::wait_for_active_tasks<Pool>' : invalid template argument for template parameter 'ShutdownPolicy', expected a class template
with
[
Pool=boost::threadpool::fifo_pool
]
error C3200: 'boost::threadpool::fifo_pool' : invalid template argument for template parameter 'SizePolicy', expected a class template
see reference to class template instantiation 'boost::threadpool::thread_pool<Task,SchedulingPolicy,SizePolicy,SizePolicyController,ShutdownPolicy>' being compiled
with
[
Task=boost::threadpool::task_func,
SchedulingPolicy=boost::threadpool::fifo_scheduler,
SizePolicy=boost::threadpool::fifo_pool,
SizePolicyController=boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
ShutdownPolicy=boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(79) : error C3200: 'boost::threadpool::resize_controller<Pool>' : invalid template argument for template parameter 'SizePolicyController', expected a class template
with
[
Pool=boost::threadpool::fifo_pool
]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(79) : error C3200: 'boost::threadpool::wait_for_active_tasks<Pool>' : invalid template argument for template parameter 'ShutdownPolicy', expected a class template
with
[
Pool=boost::threadpool::fifo_pool
]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(91) : error C2059: syntax error : '<'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(91) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(92) : error C2059: syntax error : '<'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(92) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(111) : error C2146: syntax error : missing ';' before identifier 'size_controller'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(111) : error C2501: 'boost::threadpool::thread_pool<Task,SchedulingPolicy,SizePolicy,SizePolicyController,ShutdownPolicy>::size_controller_type' : missing storage-class or type specifiers
with
[
Task=boost::threadpool::task_func,
SchedulingPolicy=boost::threadpool::fifo_scheduler,
SizePolicy=boost::threadpool::fifo_pool,
SizePolicyController=boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
ShutdownPolicy=boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(112) : warning C4183: 'size_controller': missing return type; assumed to be a member function returning 'int'
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped

According to your comment, tsk is a variable. You can't pass runtime expressions (such as a variable) as template parameters. Templates are entirely compile-time.
For this specific problem, you just need to do this:
typedef boost::threadpool::thread_pool<> pool;
void taskfunc();
// later on...
pool my_pool;
my_pool.schedule(&taskfunc);
boost::threadpool::task_func is just a boost::function0<void> — any 0-arg void function pointer can convert to that type.

Related

Intel pin and chrono conflicts

I try to measure the runtime of the program using Intel Pin. For this purpose I include chrono in my project. However It is not going to compile well. It gives a lot of errors. Furthermore, I tried to include chrono to many standart Intel Pin examples - the same result.
Could you please help me to solve errors below?
ratio(24,32): error C2143: syntax error: missing ',' before '<'
ratio(25): message : see reference to class template instantiation 'std::_Abs<_Val>' being compiled
ratio(30,38): error C2143: syntax error: missing ',' before '<'
ratio(31): message : see reference to class template instantiation 'std::_Safe_mult<_Ax,_Bx,_Sfinae,_Good>' being compiled
ratio(40,36): error C2143: syntax error: missing ',' before '<'
ratio(41): message : see reference to class template instantiation 'std::_Sign_of<_Val>' being compiled
ratio(45,38): error C2143: syntax error: missing ',' before '<'
ratio(46): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,_Good,_Also_good>' being compiled
ratio(50,44): error C2760: syntax error: unexpected token ',', expected 'expression'
ratio(51): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,false,false>' being compiled
ratio(65,41): error C2143: syntax error: missing ',' before '<'
ratio(66): message : see reference to class template instantiation 'std::_GcdX<_Ax,0>' being compiled
ratio(74,2): error C2504: 'integral_constant': base class undefined
ratio(74,38): error C2143: syntax error: missing ',' before '<'
ratio(158,5): error C2065: 'void_t': undeclared identifier
ratio(158,1): error C2226: syntax error: unexpected type 'std::_Ratio_multiply<_R1,_R2>::_Num::type'
ratio(159,1): error C2988: unrecognizable template declaration/definition
ratio(159,1): error C2059: syntax error: '>'
ratio(159,58): error C2143: syntax error: missing ';' before '{'
ratio(159,58): error C2447: '{': missing function header (old-style formal list?)
ratio(186,35): error C2143: syntax error: missing ',' before '<'
ratio(188): message : see reference to class template instantiation 'std::ratio_equal<_R1,_R2>' being compiled
ratio(195,39): error C2143: syntax error: missing ',' before '<'
ratio(197): message : see reference to class template instantiation 'std::ratio_not_equal<_R1,_R2>' being compiled
ratio(252,34): error C2143: syntax error: missing ',' before '<'
ratio(254): message : see reference to class template instantiation 'std::ratio_less<_R1,_R2>' being compiled
ratio(261,40): error C2143: syntax error: missing ',' before '<'
ratio(263): message : see reference to class template instantiation 'std::ratio_less_equal<_R1,_R2>' being compiled
ratio(279,43): error C2143: syntax error: missing ',' before '<'
ratio(282): message : see reference to class template instantiation 'std::ratio_greater_equal<_R1,_R2>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(512,39): error C2371: 'wint_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(52): message : see declaration of 'wint_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(513,39): error C2371: 'wctype_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(77): message : see declaration of 'wctype_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(538,19): error C2371: 'mbstate_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(58): message : see declaration of 'mbstate_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(552,28): error C2371: 'time_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\sys\types.h(91): message : see declaration of 'time_t'
vcruntime_new.h(34,26): error C2011: 'std::nothrow_t': 'struct' type redefinition
1>E:\Tools\source\pin\extras\libstdc++\include\new(10): message : see declaration of 'std::nothrow_t'
vcruntime_new.h(168,5): error C2084: function 'void *operator new(size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(36): message : see previous definition of 'new'
vcruntime_new.h(174,5): error C2084: function 'void operator delete(void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(40): message : see previous definition of 'delete'
vcruntime_new.h(184,5): error C2084: function 'void *operator new[](size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(37): message : see previous definition of 'new[]'
vcruntime_new.h(190,5): error C2084: function 'void operator delete[](void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(41): message : see previous definition of 'delete[]'
xtimec.h(28,15): error C2144: syntax error: 'int' should be preceded by ';'
xtimec.h(28,19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(30,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(31,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(31,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(31,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(32,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(32,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(32,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(36,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(36,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(36,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(37,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(37,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(37,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
chrono(28,55): error C2143: syntax error: missing ',' before '<'
chrono(29): message : see reference to class template instantiation 'std::chrono::treat_as_floating_point<_Rep>' being compiled
chrono(96,43): error C2143: syntax error: missing ';' before '<'
chrono(171): message : see reference to class template instantiation 'std::chrono::duration<_Rep,_Period>' being compiled
chrono(96,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(96,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(96,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(97,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(101,43): error C2143: syntax error: missing ';' before '<'
chrono(101,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(101,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(101,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(102,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(223,24): error C2143: syntax error: missing ',' before '<'
chrono(224): message : see reference to class template instantiation 'std::_Lcm<_Ax,_Bx>' being compiled
chrono(228,19): error C2988: unrecognizable template declaration/definition
chrono(228,19): error C2143: syntax error: missing ';' before '<'
chrono(228,19): error C2059: syntax error: '<'
chrono(228,37): error C2065: '_Rep1': undeclared identifier
chrono(228,44): error C2065: '_Period1': undeclared identifier
chrono(228,28): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(228,28): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(229,22): error C2065: '_Rep2': undeclared identifier
chrono(229,29): error C2065: '_Period2': undeclared identifier
chrono(229,13): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(229,13): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(229,40): error C2143: syntax error: missing ';' before '{'
chrono(229,40): error C2447: '{': missing function header (old-style formal list?)
chrono(235,8): error C2976: 'std::common_type': too few template arguments
chrono(228): message : see declaration of 'std::common_type'
chrono(238,2): error C2976: 'std::common_type': too few template arguments
chrono(236): message : see declaration of 'std::common_type'
chrono(243,39): error C2988: unrecognizable template declaration/definition
chrono(243,39): error C2143: syntax error: missing ';' before '<'
chrono(243,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(243,39): error C2059: syntax error: '<'
chrono(243,49): error C2065: '_Rep1': undeclared identifier
chrono(243,56): error C2065: '_Period1': undeclared identifier
chrono(243,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(243,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(243,76): error C2065: '_Rep2': undeclared identifier
chrono(243,83): error C2065: '_Period2': undeclared identifier
chrono(243,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(243,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(244,34): error C2065: '_Rep1': undeclared identifier
chrono(244,41): error C2065: '_Period1': undeclared identifier
chrono(244,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(244,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(244,74): error C2065: '_Rep2': undeclared identifier
chrono(244,81): error C2065: '_Period2': undeclared identifier
chrono(244,65): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(244,65): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(245,81): error C2143: syntax error: missing ';' before '{'
chrono(245,81): error C2447: '{': missing function header (old-style formal list?)
chrono(251,39): error C2988: unrecognizable template declaration/definition
chrono(251,39): error C2143: syntax error: missing ';' before '<'
chrono(251,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(251,26): error C2374: 'std::chrono::common_type_t': redefinition; multiple initialization
chrono(243): message : see declaration of 'std::chrono::common_type_t'
chrono(251,39): error C2059: syntax error: '<'
chrono(251,49): error C2065: '_Rep1': undeclared identifier
chrono(251,56): error C2065: '_Period1': undeclared identifier
chrono(251,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(251,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(251,76): error C2065: '_Rep2': undeclared identifier
chrono(251,83): error C2065: '_Period2': undeclared identifier
chrono(251,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(251,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(252,34): error C2065: '_Rep1': undeclared identifier
chrono(252,41): error C2065: '_Period1': undeclared identifier
chrono(252,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(252,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(252,74): error C2065: '_Rep2': undeclared identifier
chrono(252,81): error C2065: '_Period2': undeclared identifier
chrono(252,1): fatal error C1003: error count exceeds 100; stopping compilation

boost::variate_generator syntax error

may I please seek some help with the issue I am having.
I have the typedef
typedef boost::random::mt19937 my_rng;
typedef boost::math::students_t my_st;
and then the following:
my_rng rng(0) ;
my_st st(3);
boost::random::variate_generator<my_rng&, my_st > noise(rng, st);
The compilation error that I get is (I am using visual studio 13 in windows 7) :
1>C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59): error C2039: 'result_type' : is not a member of
'boost::math::students_t_distribution>'
1> ....\test.cpp(183) : see reference to class template instantiation 'boost::random::variate_generator' being compiled
1>C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59): error C2146: syntax error : missing ';' before identifier 'result_type'
1>C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59): error C2602: 'boost::random::variate_generator::result_type' is not a member of a base class of 'boost::random::variate_generator'
1> C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59) : see declaration of 'boost::random::variate_generator::result_type'
1>C:\boost\boost_1_61_0\boost/random/variate_generator.hpp(59): error C2868: 'boost::random::variate_generator::result_type' : illegal syntax for using-declaration; expected qualified-name
Can someone please give me some pointers how to fix this. Thanks in advance.
boost:math::students_t does not satisfy the concept of a Random Distribution. Use boost::random::student_t_distribution instead.

Using variadic template by lambda capture and pass to function's argument

template<typename FN_, typename ... Arguments>
SuspendThread(FN_&& func, Arguments&& ... args)
{
auto fut_suspend = Psuspend.get_future();
std::thread it(
[fut = std::move(fut_suspend), func, args ...]()
{
fut.wait();
func(std::forward<Arguments>(args)...);
});
task.swap(it);
}
I use VS 2015 RC. Now I'm making just simple things.
I want to make func to use args but while template instantiation it's get
error.
Am I wrong to use variadic template with lambda?
Here is full error:
1>PATH\suspendthread.hpp(29): error C2337: 'fut': attribute not found
1>PATH\main.cpp(6): note: see reference to function template
instantiation
'SuspendThread::SuspendThread<main::<lambda_380b530b324058b12b3b95b6ff957dd6>,int,int>(FN_
&&,int &&,int &&)' being compiled 1 with 1 [ 1
FN_=main::<lambda_380b530b324058b12b3b95b6ff957dd61 ]
1>PATH\suspendthread.hpp(29): error C2337: 'move': attribute not found
1>PATH\suspendthread.hpp(29): error C2337: 'func': attribute not found
1>PATH\suspendthread.hpp(29): error C2337: 'args': attribute not found
1>PATH\suspendthread.hpp(29): error C2143: syntax error: missing ']'
before '...'
1>PATH\suspendthread.hpp(29): error C2143: syntax error: missing ')'
before ']'
1>PATH\suspendthread.hpp(29): error C2143: syntax error: missing ';'
before ']'
1>PATH\suspendthread.hpp(29): error C2059: syntax error: ']'
1>PATH\suspendthread.hpp(29): error C2143: syntax error: missing ';'
before '{'
1>PATH\suspendthread.hpp(31): error C2065: 'fut': undeclared
identifier
1>PATH\suspendthread.hpp(31): error C2228: left of '.wait' must have
class/struct/union
1>PATH\suspendthread.hpp(31): note: type is 'unknown-type'
1>PATH\suspendthread.hpp(33): error C2059: syntax error: ')'
1>PATH\suspendthread.hpp(34): error C2664: 'void
std::thread::swap(std::thread &) noexcept': cannot convert argument 1
from 'std::thread (__cdecl *)(...)' to 'std::thread &'

BUG on boost spirit?

I'm trying to migrate my code from VSC++ 6 to VSC++ 2008 express edition and from Intel compiler to Microsoft compiler. Everything were easy to migrate except that I'm receiving this errors now:
1>------ Build started: Project: Base, Configuration: Debug Win32 ------
1>Compiling...
1>DefaultScriptReader.cpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic.hpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic_dynamic.hpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(53) : see reference to class template instantiation 'boost::spirit::lazy_parser<ActorT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(34) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(40) : error C2065: 'actor_result_t' : undeclared identifier
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(42) : see reference to class template instantiation 'boost::spirit::lazy_parser<ActorT>::result<ScannerT>' being compiled
1>Warning: This header is deprecated. Please use: boost/spirit/include/phoenix1.hpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic_grammar_def.hpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(104) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(112) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : see reference to class template instantiation 'boost::spirit::grammar_def<T,T0,T1,T2,T3,T4,T5,T6,T7>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(187) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2143: syntax error : missing ';' before '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2988: unrecognizable template declaration/definition
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2059: syntax error : '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(297) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(298) : error C2760: syntax error : expected '{' not ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : fatal error C1075: end of file found before the left brace '{' at 'c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(54)' was matched
1>Build log was saved at "file://c:\Desenvolvimento\DFF\VC9\Base\Debug\BuildLog.htm"
1>Base - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
How you can see, the MS Compiler shows syntax errors on boost library.
I found on boost site that this compiler, version 9, is compatible to the library.
So, what is going on to my code?
The code with deprecated parts fixed:
1>------ Build started: Project: Base, Configuration: Debug Win32 ------
1>Compiling...
1>DefaultScriptReader.cpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(53) : see reference to class template instantiation 'boost::spirit::classic::lazy_parser<ActorT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(34) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(40) : error C2065: 'actor_result_t' : undeclared identifier
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(42) : see reference to class template instantiation 'boost::spirit::classic::lazy_parser<ActorT>::result<ScannerT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(104) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(112) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : see reference to class template instantiation 'boost::spirit::classic::grammar_def<T,T0,T1,T2,T3,T4,T5,T6,T7>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(187) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2143: syntax error : missing ';' before '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2988: unrecognizable template declaration/definition
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2059: syntax error : '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(297) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(298) : error C2760: syntax error : expected '{' not ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : fatal error C1075: end of file found before the left brace '{' at 'c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(56)' was matched
1>Build log was saved at "file://c:\Desenvolvimento\DFF\VC9\Base\Debug\BuildLog.htm"
1>Base - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks
Leandro Lima
The problem was resolved just including phoenix1. The old version of phoenix.

Visual C++ 2008 Boost Problem

Hey I'm using the C++ Communication Services Framework, which uses the Boost's Thread library.
I'm compiling one of their test projects (CSF's) and i'm getting a huge errors
The errors are in the Boost Bind library in file bind/mem_fn_template.hpp
EDIT: I installed Boost through the Boost installers provided by BoostPro
Here are few of the errors
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(193) : see reference to class template instantiation 'boost::_mfi::mf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(243) : see reference to class template instantiation 'boost::_mfi::cmf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(305) : see reference to class template instantiation 'boost::_mfi::mf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(353) : see reference to class template instantiation 'boost::_mfi::cmf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(415) : see reference to class template instantiation 'boost::_mfi::mf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(463) : see reference to class template instantiation 'boost::_mfi::cmf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(525) : see reference to class template instantiation 'boost::_mfi::mf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(573) : see reference to class template instantiation 'boost::_mfi::cmf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(635) : see reference to class template instantiation 'boost::_mfi::mf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(683) : see reference to class template instantiation 'boost::_mfi::cmf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(745) : see reference to class template instantiation 'boost::_mfi::mf6<R,T,A1,A2,A3,A4,A5,A6>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : fatal error C1003: error count exceeds 100; stopping compilation
The offending line is
template<class U, class B1> R call(U & u, T const *, B1 & b1) const
Are you sure you don't have any macro named either U or B1? You can probably do search over all sources for '#define U' and '#define B1'.
The C++ Communication Services Framework hasn't been updated since 2005, whereas Boost::Thread has been updated frequently since then so it's possible that something's changed that has broken backwards compatibility. I'd suggest trying Boost 1.33 to see if it gives the same errors.