No overloaded function takes 6 arguments error

Im getting the a error that reads *Error 1 error C2661: 'StudentInfo::StudentInfo' : no overloaded function takes 6 arguments


This is my code in my .h file:

public:
StudentInfo(); //Constructor
StudentInfo(string lName, string fmName, string grade, double t1, double t2, double t3, double a); //Constructor with Parameters

This is the code in my .cpp file:

//Constructor with parameters
StudentInfo anStudent(lastName, fmName, letterGrade, testScore1, testScore2, testScore3, absent);

Where am I going wrong?
Can you show any more code? (By the way, you ought to use [code][/code] tags around your code.) What you've given looks fine as it is; is that actually where the error is occurring?
This is from my .h file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//Specification file for the Student Info class
#ifndef STUDENTINFO_H
#define STUDENTINFO_H
#include <string>
using namespace std;

//StudentInfo class declaration

class StudentInfo
{
private:
	string lastName;
	string firstMiddle;
	string letterGrade;
	double testScore1;
	double testScore2;
	double testScore3;
	double testAvg;
	double absent;
	double finalGrade;
	
public:
	StudentInfo();                                                                                              //Constructor
	StudentInfo(string lName, string fmName, string grade, double t1, double t2, double t3, double a);          //Constructor with Parameters
	void setLastName(string lName);                                                                             //Set student last name
	void setFirstMiddle(string fmName);                                                                         //Set student first and middle name
	void setLetterGrade(string grade);                                                                          //Set letter grade
	void setScore1(double t1);                                                                                  //Set Test score 1
	void setScore2(double t2);                                                                                  //Set Test score 2
	void setScore3(double t3);                                                                                  //Set Test score 3
	void setDays(double a);                                                                                     //Set Absent days

	string getLastName();                                    //Return Student last name
	string getFirstMiddle();                                 //Return Student first and middle name
	string getGrade();                                       //Return Letter grade
	double getScore1();                                      //Return Test score 1
	double getScore2();                                      //Return Test score 2
	double getScore3();                                      //Return Test score 3
	double getDays();                                        //Return Absent days

	void splitLine();                                                      //Convert data from file
	double calcTestScores();                                               //Calculate test score average
	double calcAbsentPoints();                                             //Calculate points for absent days
	double calcGPA();                                                      //Calculate final grade
};
#endif 
This is where the error occurs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//This program accepts a students name, 3 test scores, and number of absences.
//Then converts them into a final grade which will be labeled as successful or unsuccesful

#include "StudentInfo.h"
#include<iostream> 
#include<string> 
#include<cmath>
#include<iomanip>
#include<sstream>
#include<fstream>;
using namespace std;

//Function Prototypes
void inputInfo(string& studentName, double &testScore1, double &testScore2, double &testScore3, double &absent);
void performCalcs(StudentInfo anStudent);

int main()
{
	ifstream inputFile;

	inputFile.open("studentdata.txt");

	//File open error
	if (inputFile.fail())
	{
		cout << "ERROR: 'studentdata.txt' not found" << endl;
		cout << endl;
	}

	

	//Local Variables
	string lastName, fmName, letterGrade, line;
	double testScore1, testScore2, testScore3, absent, testAvg;

	//Get lines from file
	getline(inputFile, line);

	while(!inputFile.eof())
	{
		void splitLine(StudentInfo anStudent);
	}

	//Constructor with parameters
	StudentInfo anStudent(lastName, fmName, letterGrade, testScore1, testScore2, testScore3, absent);

For some reason line 45 continues to generate the error
Well it compiles fine for me. Try forcing a rebuild and see if that helps.
Wow, it was as simple as that! Thanks very much.
Topic archived. No new replies allowed.