我使用eclipse 3.7.2並使用MinGW gcc 4.6.1作爲我的編譯器。 每件事情都可以, 也包括我的源文件頭,但我不能在源文件中定義任何矢量類型。當我在下面的圖像中註釋掉錯誤行時,每件事情都很順利並且編譯得很好。我不知道這個問題。std :: vector在windows平臺上的eclipse中缺失
-1
A
回答
5
你錯過了模板參數作爲錯誤信息提示:
vector<int> arr;
你想存儲
3
類型取代INT你必須明確你的Vector的template type
。
喜歡vector<int> arr;
看看這樣:
在他們在C++標準模板庫矢量執行需要兩個模板參數: 模板<類T,類分配器=分配器>類矢量; 其中模板參數具有以下含義:
T:元素的類型。
分配器:用於定義存儲分配模型的分配器對象的類型。 默認情況下,使用類型T的分配器類模板 ,該模板定義最簡單的內存分配模型並且與值無關。
1
vector
是C++模板類型,你需要像指定它的模板參數(一個什麼樣的載體?)vector<int>
相關問題
- 1. Windows Azure平臺的缺點?
- 2. easy_install M2Crypto在Windows平臺上失敗
- 3. 如何構建從一個std平臺::陣:: vector的
- 4. Eclipse - 控制檯視圖在一個缺失的屏幕上
- 5. Redis在windows平臺上
- 6. android在eclipse中缺失
- 7. Windows平臺上的IP_TRANSPARENT
- 8. Universal WIndows平臺上的Mono.data.sqlite
- 9. Ant構建失敗,並在Windows平臺
- 10. 忽略平臺'android-2':build.prop缺失
- 11. 「SDK平臺工具組件缺失」
- 12. std ::奇怪平臺上的字節
- 13. std :: vector <std :: vector <T>> vs std :: vector <T*>
- 14. 如何在Windows平臺上製作pydev/eclipse編譯cython模塊
- 15. std :: vector vs std :: insert
- 16. iterate std :: vector <std :: vector <char>>?
- 17. getpid在Windows平臺上的COBOL
- 18. std :: unique_locks的std :: vector向量
- 19. Windows平臺上的問題有關Windows平臺上的靜態庫
- 20. 在std :: vector上使用std :: unique()<std :: unordered_set <T>>
- 21. 在Visual Studio 2010中缺少Windows 8 SDK平臺工具集
- 22. 其中std :: vector :: emplace_back比std :: vector :: push_back慢的示例?
- 23. std :: vector :: erase()(多線程)'assertion'px!= 0'失敗。'
- 24. MongoDB是在Windows Azure平臺上Azure平臺
- 25. 手動中毒的std :: vector
- 26. std :: vector中的高效push_back
- 27. 在空std :: vector上使用運算符[]
- 28. 在C++中使用std :: vector的性能損失是多少?
- 29. 在Windows 7平臺上在Eclipse Indigo IDE上使用Java jpcap進行編程
- 30. std :: vector的消失內容<std::string>
嘗試矢量 ARR;或矢量 arr;或矢量 arr;你必須用一個類型實例化一個模板。 –
Robinson
2012-03-22 11:00:52