我正在尝试调试程序,并且正在从名为intInputFile的文件中读取值。我正在查看我的局部变量,发现它说intInputFile =不完整的类型。我尝试查找它,但是没有明确的答案,我不知道这意味着什么。谁能解释一下,因为我认为这使我的程序搞砸了。

谢谢。

intInputFile >> fileInt;
cout << "check" <<endl;
while(!intInputFile.eof())
{
    intNode* anotherInt;
    anotherInt = new intNode;
   if(intList==NULL)
   {
       intList = anotherInt;
       lastInt = anotherInt;
       lastInt->nextNode = NULL;
       lastInt->nextNode = new intNode;
   }
   else
   {
      lastInt = lastInt->nextNode;
      lastInt->nextNode = NULL;
      lastInt->nextNode = new intNode;
   }
   lastInt->intValue = fileInt;
   intInputFile >> fileInt;
   cout << "good" <<endl;
}

第一次执行后,它正确地从文件中读取了第一个整数,但是调试时我注意到类型不完整。另外,我加入了cout <
这里包括:
   #include <iostream>
   #include <string>
   #include <fstream>

我将其定义为常规的ifstream类型:
  int fileInt; //int read from input file
  ifstream intInputFile;

最佳答案

缺少的包含或多个包含或某些导致intInputFile类型的定义在该行代码中不可见的内容。

09-11 05:40