3

I have recently added MLPack to my software, and I tried to compile the MLPack as coming from CMake. MLPack itself builds just fine with Visual Studio 2012, and then I wanted to integrate it into my own software.

I have not even done one line of code with it yet, just a

#include "../../mlpack-1.0.8/build-VS/include/mlpack/core.hpp"

in one of my headers. Thats all, and when I want to compile it, I get a huge list of errors, all coming from Boost 1.55, the first three errors are for example (1-6 are warnings)

Error   7   error C2332: 'class' : missing tag name d:\development\boost_1_55_0\boost\iterator\iterator_facade.hpp  43
Error   8   error C2011: '<unnamed-tag>' : 'enum' type redefinition d:\development\boost_1_55_0\boost\iterator\iterator_facade.hpp  43
Error   9   error C2143: syntax error : missing ',' before 'constant'   d:\development\boost_1_55_0\boost\iterator\iterator_facade.hpp  43

The line from the iterator_facade.hpp is

  template <class I, class V, class TC, class R, class D> class iterator_facade;

What is happening here?

coatless
  • 20,011
  • 13
  • 69
  • 84
SinisterMJ
  • 3,425
  • 2
  • 33
  • 53
  • 1
    Usually these kinds of errors come from a missing ; at the end of a class definition in a header file (or some similar, unterminated construct in a header file). This missing ; spreads across the header file that it is missing in and the header files that are included afterwards. Because mlpack/core.hpp seems to be fine, I'm not sure whether this might be the problem. – Daniel Albuschat Jul 29 '14 at 10:40
  • MLPack on its own compiles fine, so I don't even know how to begin tracking this error. – SinisterMJ Jul 29 '14 at 10:44
  • Does your code include boost, or does mlpack include boost, or both? If you include boost yourself, can you give more context around the posted #include line? – Daniel Albuschat Jul 29 '14 at 11:39
  • No, its only MLPack that uses Boost. My code does not use Boost. – SinisterMJ Jul 29 '14 at 11:46
  • Maybe your Platform Toolset (see the project properties) in your actual code is older than what you used to compile mlpack. – Daniel Albuschat Jul 29 '14 at 12:08
  • Just checked, it is set to 110 (VS2012, same as MLPack) – SinisterMJ Jul 29 '14 at 12:19
  • My guess is that someone somewhere has #defined a macro named I or V or TC (most likely) or R or D. (since there's no 'constant' or 'enum' on that line. But this is just a guess. – Marshall Clow Jul 29 '14 at 14:30
  • No, I haven't used any one character class variables or similar anywhere, so that would be something Boost intern I guess. – SinisterMJ Jul 29 '14 at 16:12
  • Take a look at a preprocessed file. I guess some macro messes up the code. – Igor R. Jul 30 '14 at 07:25
  • Funny enough, changing the order of includes made it work... really odd behaviour. – SinisterMJ Jul 30 '14 at 19:23

0 Answers0