1
我剛配置的C/C++在Ubuntu上 和NetBeans當我嘗試使用std ::對似乎編譯器無法找到它 這是非常奇怪的 C++的默認版本是C++ 11 是我的代碼的片爲什麼找不到的std ::對在NetBeans在Ubuntu
int n, k;
cin >> n>>k;
vector<pair<int,int> > x(n);
在此先感謝
我剛配置的C/C++在Ubuntu上 和NetBeans當我嘗試使用std ::對似乎編譯器無法找到它 這是非常奇怪的 C++的默認版本是C++ 11 是我的代碼的片爲什麼找不到的std ::對在NetBeans在Ubuntu
int n, k;
cin >> n>>k;
vector<pair<int,int> > x(n);
在此先感謝
您需要包括正確的頭文件的源文件的開頭,這樣編譯器瞭解不同的類型/對象:
#include <iostream> // For std::cin
#include <vector> // For std::vector
#include <utility> // For std::pair
如果你想(在main()典型值)默認使用std命名空間:
using namespace std;
謝謝大家:d –
你試圖在你的程序中添加? –
您顯示的代碼需要#include','#include ','#include '和[非常氣餒](http://stackoverflow.com/q/1452721/1782465)'使用命名空間性病;'。所有這些都出現在你的代碼中? –
Angew
我建議您檢查例如[這個'std :: pair'參考](http://en.cppreference.com/w/cpp/utility/pair)。 –