I have code that I wrote quite a while ago, and I don't do that much 'C++' these days. I've compiled the code with no issues in 'Visual C++ 2010 Express'. I've compiled it in vs2015 and I get an error with the 'std::array'. Could someone be kind enough to explain my error.
This compiled ok in 'Visual C++ 2010 Express'
// create arrays to hold port write data
array<DataChunk>^ dataArray = gcnew array<DataChunk>(1008);
But compiled in vs2015 with the error:
1>c:\users\carl\desktop\pond control\pond control\Form1.h(1199): error C2976: 'std::array': too few template arguments
1> C:\Program Files\Microsoft Visual Studio 14.0\VC\include\utility(306): note: see declaration of 'std::array'
Any help would be most appreciated.
Mat
208k41 gold badges409 silver badges423 bronze badges
asked May 22, 2015 at 11:26
fatmanming
1951 gold badge3 silver badges12 bronze badges
-
^ or *: array<DataChunk>* dataArray911– 9112015年05月22日 11:29:42 +00:00Commented May 22, 2015 at 11:29
-
try: array<DataChunk, 1008>;911– 9112015年05月22日 11:31:04 +00:00Commented May 22, 2015 at 11:31
1 Answer 1
std::array is a container data type that encapsulates "regular" fixed-size arrays. You need to provide the array size as a template parameter:
auto dataArray = gcnew array<DataChunk,1008>();
answered May 22, 2015 at 12:12
unexpectedvalue
6,1393 gold badges40 silver badges64 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
fatmanming
I've tried that and it comes up with 'Error:incomplete type is not allowed', at the array declaration after gcnew.
fatmanming
I've installed VS2013 and it compiles ok in that. It must be the libraries in the vs2015 ?
lang-cpp