0

Sorry this is probably a stupid question, as I couldn't find anything at all on google on the subject. Anyways I'm trying to compile some source code, that uses boost::array with visual studio 2005, as a Win32 console application (not clr), however for some reason that escapes me Visual Studio still considers the word array a keyword, so it chokes on all the boost::array<>'s in the code with errors like this:

Error   1   error C2039: 'array' : is not a member of 'boost'
d:\projects\libraries\boost_1_36_0-1\boost_1_36_0\boost\asio\buffer.hpp 809

I'm quite sure there is something terribly stupid and probably obvious I'm missing as no one in the world seems to have this problem (according to Google's results I found)

3
  • 1
    'array' is merely recognized by the syntax highlighter, so I don't think the compiler has a preconceived notion of arrays outside of /clr projects. Strange that asio's buffer should fail to find the array type, it includes boost/array.hpp. Do you have another array type in the global scope? Commented Aug 18, 2009 at 7:26
  • Not that I can think of, which is the whole issue, if I compile with /Za (no language extensions) it recognizes boost::array<> ok, but fails in other parts. So it's really really weird :/ Commented Aug 18, 2009 at 7:31
  • If you right click on 'array' and choose "Go to Definition" or "Go to Declaration" does it take you somewhere that might give a clue? Commented Aug 18, 2009 at 8:10

1 Answer 1

1

This simple program compiled and worked perfectly in my VC++ 2005:

#include <iostream>
#include <boost/array.hpp>

int
main()
{
     const int size = 3;
     boost::array<double,size> myArray;
     myArray[0] = 23.43f;
     myArray[1] = 24.00f;
     myArray[2] = 23.50f;
     double sum = 0.0;
     for (size_t i = 0; i < myArray.size(); ++i) 
     {
         sum += myArray[i];
     }
     std::cout << "sum=" << sum << '\n';
     return 0;
}

Could you post a small code snippet that fails?

Sign up to request clarification or add additional context in comments.

1 Comment

This actually didn't compile :/ So I downloaded Boost again, and now it does. Somehow my boost distribution was broken.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.