vector实例化的模板参数无效
Invalid Template Argument for vector instantiation
当我运行这段代码时,我在最后一行得到"无效模板参数"错误。请建议。(我省略了其余的代码)
#include <iostream>
#include <fstream>
#include<array>
#include <vector>;
using namespace std;
int fileLineCount(string);
int fileExists(string[],int);
int main() {
ifstream archiveFile;
archiveFile.open("StudentRecords.txt");
int lineCount=fileLineCount("StudentRecords.txt");
string line;
vector<string> recordArray;
#include <vector>;
应为
#include <vector>
,当然你需要在main()
的末尾关闭}
大括号(尽管这可能是一个打字错误)。您还应该#include <string>
,尽管您的一些头似乎隐含地包括它(可能是<iostream>
)。
相关文章:
- std::cin >>上的参数无效
- 结果失败或多个参数无效
- 错误:一元"*"的类型参数无效(具有"int"):使用 mergesort 计算
- 错误 带有模块的一元"*"(具有"int")的类型参数无效
- 由于调用 std::condition_variable 后参数无效而导致应用程序崩溃
- MPI_Iprobe:RMA 调用中的位移参数无效
- 推力::sort_by_key上的配置参数无效
- windres 致命错误:将输出写入时:参数无效
- 一元'*'的类型参数无效(有双精度)
- C++:传递给 C 运行时函数的参数无效
- 矢量模板参数无效
- 写入 -: 参数无效 } 时出错
- winsock2:recvfrom()函数以错误10022(参数无效)结束
- 模板参数的显式指定参数无效,该参数是 constexpr
- 模板参数无效
- 调用 getter 成员时的参数无效
- 模板模板参数中的参数无效
- 方法调用中的参数无效
- POSIX 计时器:参数无效
- C++类模板是一个模板:模板参数无效