c++ - Compile error due to syntax error in header file -
i have program relies on several include files. when define includes in order shown below program compiles fine.
#include <iostream> #include "opencv2/cvconfig.h" #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/core/internal.hpp" // tbb wrappers #include "arrayfire.h" however, when switch last 2 includes shown below
#include <iostream> #include "opencv2/cvconfig.h" #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "arrayfire.h" #include "opencv2/core/internal.hpp" // tbb wrappers i compiler errors:
1>d:\libraries\tbb41\tbb41_20130613oss\include\tbb\task.h(765): error c2059: syntax error : '{' 1>d:\libraries\tbb41\tbb41_20130613oss\include\tbb\task.h(765): error c2334: unexpected token(s) preceding '{'; skipping apparent function body
this unexpected , i'd fix it. of includes libraries (opencv , arrayfire). suggestions on may cause , how fix issue?
edit here's relevant part of task.h:
759 #if __tbb_task_group_context 760 //! method deprecated , removed in future. 761 /** use method group() instead. **/ 762 task_group_context* context() {return prefix().context;} 763 764 //! pointer task group descriptor. 765 task_group_context* group () { return prefix().context; } 766 #endif /* __tbb_task_group_context */ in line 765, ide complains {, saying error: expected identifier
this caused following evil in 1 of arrayfire headers:
#define group(...) __va_args__ this defines function-like macro replaced list of macro arguments; group(a,b) expands a,b, , (more importantly here) group() expands nothing. since macros have no respect language-level concepts scopes, interferes later declaration:
task_group_context* group () { return prefix().context; } converting to
task_group_context* { return prefix().context; } which not valid declaration.
the fix include "arrayfire.h" last, , careful names try use in own code; or #undef group (and other evil might perpetrate) after including it. or, if possible, kill fire , use less evil instead.
Comments
Post a Comment