vector实例化的模板参数无效

Invalid Template Argument for vector instantiation

本文关键字:参数 无效 实例化 vector      更新时间:2023-10-16

当我运行这段代码时,我在最后一行得到"无效模板参数"错误。请建议。(我省略了其余的代码)

#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>)。