Problem using Boost::Multi_Array

Hi All,

I'm trying to use the boost::multi_array in VS2010 Express and am having troubles getting the example code in the boost documentation to work for even basic things.

I have the following code straight from the sample :-

#include "multi_array.hpp"
#include <vector>
#include <string>
using namespace std;

typedef boost::multi_array<double, 3> array_type;
typedef array_type::index index;
array_type A(boost::extents[3][4][2]);



The first problem is at the <double, 3> with a comment under the ">" stating

"Ërror: Too few arguments for class template boost::multi_array"

I can get rid of that error by changing to <double, 3> to
<double, 3, std::allocator<double>>

So it seems not to be accepting the default allocator. No idea if this is correct, but it removes the warning in the IDE

Now the second problem, even after I've fixed up the first one, is that extents is underlined and the message says

"Error: namespace boost has no member extents"

I have no idea how to get rid of that error or why either of these errors have occurred when I have used the sample code and nothing on google suggests anyone else has had this problem.

I'm new to Visual Studio and C++ in general, so sorry if the answer is obvious, but I can't find it. If anyone has any advice, I'd appreciate it.

Thanks.
This code compiles cleanly for me.


 g++ --version
g++ (GCC) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


You might want to check to see if boost::multi_array is known to have compilation problems with your version of compiler.
Not that I can see. There's a Microsoft article saying it works with vs2005 and the boost site has references to visual c++.

** EDIT **

Just had a thought on the way to work, but can't try it out till tonight. If I have setup the include path for the headers, but not the path to the compiled libraries, would that give this type of error?
Last edited on
Topic archived. No new replies allowed.