2015-05-22 56 views
2

我有一段時間以前寫過的代碼,而且現在我沒有那麼多'C++'。我在「Visual C++ 2010 Express」中編譯了沒有問題的代碼。我已經在vs2015中編譯了它,並且出現了'std :: array'錯誤。有人可以善意解釋我的錯誤嗎?std :: array和VS2015錯誤

這編譯「的Visual C++ 2010 Express的

// create arrays to hold port write data​ 
array<DataChunk>^ dataArray = gcnew array<DataChunk>(1008); 

但在vs2015與錯誤編譯OK:

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' 

任何幫助將非常感激。

+0

^或\ *:陣列 * dataArray中 – 911

+0

嘗試:陣列; – 911

回答

1

std::array是封裝「常規」固定大小數組的容器數據類型。需要提供數組的大小作爲模板參數:

auto dataArray = gcnew array<DataChunk,1008>(); 
+0

我試過了,它出現'錯誤:不完整的類型是不允許的',在gcnew之後的數組聲明。 – fatmanming

+0

我已經安裝了VS2013,它編譯好了。它必須是vs2015的圖書館? – fatmanming