Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ stl c++;错误:无法打开向量头文件“0”&引用;预期_C++_Vector - Fatal编程技术网

C++ stl c++;错误:无法打开向量头文件“0”&引用;预期

C++ stl c++;错误:无法打开向量头文件“0”&引用;预期,c++,vector,C++,Vector,我搜索了很多以清除以下错误,找不到答案。 我得到以下错误。请有人帮我提前谢谢 ERROR: unable to open vector headerfile, ";" expected #包括 #包括 模板 类MyQueue { std::矢量数据; 公众: 空加(T常数&); 无效删除(); 作废打印(); }; 模板void MyQueue::Add(T const&d) { 数据。推回(d); } 模板void MyQueue::Remove() { data.erase(data.b

我搜索了很多以清除以下错误,找不到答案。 我得到以下错误。请有人帮我提前谢谢

ERROR: unable to open vector headerfile, 
";" expected
#包括
#包括
模板
类MyQueue
{
std::矢量数据;
公众:
空加(T常数&);
无效删除();
作废打印();
};
模板void MyQueue::Add(T const&d)
{
数据。推回(d);
}
模板void MyQueue::Remove()
{
data.erase(data.begin()+0,data.begin()+1);
}
模板无效MyQueue::Print()
{
std::vector::迭代器It1;
It1=data.begin();
for(It1=data.begin();It1!=data.end();It1++)
不能改变

#包括

#包括
Its

#不包括。

您没有收到任何错误,如“无法打开包含文件:'iostream.h':没有这样的文件或目录”。

编译器在哪里查找头?有某种全局设置指向正确的路径,可能是错误的。
#include <iostream.h>
#include <vector>

template <typename T>
class MyQueue
{
std::vector<T> data;
public:
void Add(T const &);
void Remove();
void Print();
};

template <typename T> void MyQueue<T> ::Add(T const &d)
{
data.push_back(d);
}

template <typename T> void MyQueue<T>::Remove()
{
data.erase(data.begin( ) + 0,data.begin( ) + 1);
}

template <typename T> void MyQueue<T>::Print()
{
std::vector <int>::iterator It1;
It1 = data.begin();
for ( It1 = data.begin( ) ; It1 != data.end( ) ; It1++ )
cout << " " << *It1<<endl;

}
//Usage for C++ class templates
void main()
{
MyQueue<int> q;
q.Add(1);
q.Add(2);

cout<<"Before removing data"<<endl;
q.Print();

q.Remove();
cout<<"After removing data"<<endl;
q.Print();
}
#include <iostream.h>
#include <iostream>
#include <iostream> not <iostream.h>.