Search code examples
c++incomplete-type

I keep getting the error invalid use of incomplete type 'struct familyFinace' how do I fix this?


I am trying to append a node but I keep getting the error incomplete type 'struct familyFinace' how do I fix this?

   #include <iostream>
#include <iomanip>
#include <fstream>
#include <familyFinance>

using namespace std;
struct familyFinance{                     
  int acctNos; float Balance; familyFinance *nextNodePointer;  familyFinance *ptrHead;  familyFinance *dynFinancePtr;
      };

void printOnesBelowThreshold (float , int [], float [], int );
void spitThemOut(struct familyFinace);
void anyBelowThreshold(struct familyFinance [], int , float,
      struct familyFinance &); 

int main() {
 

  int noAccounts = 7, Option; float Threshold;
  struct familyFinance startNodeOption3 ;

  familyFinance financeAry[10];

  ifstream Lab3DataFileHandle;
  int num;
  float money;
 
familyFinace *ptrHead=nullptr;
familyFinace *dynFinancePtr=nullptr;
 familyFinace *tempPtr;
 tempPtr=ptrHead;

  Lab3DataFileHandle.open("Lab5Data.txt");
  while (!Lab3DataFileHandle.eof( )) {
    familyFinance *dynFinancePtr= new familyFinance;


 Lab3DataFileHandle >> dynFinancePtr -> acctNos; 
 Lab3DataFileHandle >> dynFinancePtr -> Balance;
 
 familyFinace  *ggnextNodePointer = nullptr;
  if (ptrHead == nullptr)  
   familyFinance *ptrHead  = dynFinancePtr;
else {      
 tempPtr =  ptrHead;  

down bellow is the main problem with the code on these lines I get invalid use of incomplete type 'struct familyFinace'

 while  (tempPtr -> nextNodePointerx != nullptr )
    tempPtr = tempPtr->nextNodePointer;
      tempPtr->nextNodePointer = dynFinancePt

Solution

  • invalid use of incomplete type 'struct familyFinace'

    how do I fix this?

    Include the header for familyFinance before using the type. The compiler needs to see how the type is declared before you can use it.