I Don't know what these errors mean

I having some big trouble with this program i am trying to write and i am completely out of practice
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <array>
#include <istream>

using namespace std;

enum Season {WINTER, SPRING, SUMMER, FALL};

struct WeatherData		// Holds weather data from all three files
{
	string date;			// Date of observation
	int highTemp;			// High temperature recorded
	int lowTemp;			// Low temperature recorded
	int avgTemp;			// Average temperature for date
	int departNorm;		// Departure from normal temperature
	int avgDP;				// Average dew point for the date
	int avgRH;				// Average relative humidity for the date
	int avgWind;			// Average wind speed recorded for the date
	float avgPress;		// Average barometric pressure for the date
	float totPrecip;		// Total precipitation for the date, (-1 if none)
	int noObs;				// Number of observations taken for the date
};

struct YearStats			// Holds the yearly totals, highs, lows for summary
{
	int highTemp;			// Highest temp encountered for year so far
	string highTempDate;	// Date of highest temp encountered
	int lowTemp;			// Lowest temp encountered for year so far
	string lowTempDate;	// Date of the lowest temp encountered
	float highPrecip;		// Highest precipitation encountered for year so far
	string highPrecDate;	// Date of highest precipitation encountered
	int totHigh;			// Accumulator for high temperatures
	int totLow;				// Accumulator for low temperatures
	int totDP;				// Accumulator for dew points
	int totRH;				// Accumulator for relative humidities
	int totWind;			// Accumulator for wind speeds
	float totPress;		// Accumulator for barometric pressures
	float totPrecip;		// Accumulator for precipitation
	int obsCnt;				// Counter of number of dates for averages
};

struct SeasonStats		// Holds the season totals for summary
{
	int totHigh;			// Accumulator for high temperatures
	int totLow;				// Accumulator for low temperatures
	int totDP;				// Accumulator for dew points
	int totRH;				// Accumulator for relative humidities
	int totWind;			// Accumulator for wind speeds
	float totPress;		    // Accumulator for barometric pressures
	float totPrecip;		// Accumulator for precipitation
	int obsCnt;				// Counter of number of dates for averages
};

int main()
{
	WeatherData dailyWeaRec;
	Season curSeason;
	YearStats curYearStats;
	SeasonStats winterStats, springStats, summerStats, fallStats;
	ifstream tempData, atmData, precData;
	ofstream winterOut, springOut, summerOut, fallout;
	bool validDate = true;
	bool firstRec = true;
	bool newYear;

	ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout);
	//V change to actual code
    if (=!ReadyFiles){
		cout << "print error message to screen";
		exit(exit_code);
    }

	ReadFiles(tempData, atmData, precData, dailyWeaRec, validDate);

	while (tempData not eof and validDate){
       
		newYear = CheckNewYear (dailyWeaRec.date)  //have I encountered a new year
		if (newYear)
			if (firstRec)   // I will get a new year for first record, but don’t 
				firstRec = false  // print stats  
			else
				OutputStats(curSeason,curYearStats, winterStats, springStats,
					summerStats, fallStats)
			ResetStats(dailyWeaRec, curYearStats, winterStats, springStats,
					summerStats, fallStats)
    }
		curSeason = ProcessSeason(dailyWeaRec.date)

		switch (curSeason)
 			case (WINTER):	CreateOutputRec(dailyWeaRec, winterOut)
								ComputeStats(dailyWeaRec, curYearStats, winterStats)
			case (SPRING):	CreateOutputRec(dailyWeaRec, springOut)
								ComputeStats(dailyWeaRec, curYearStats, springStats)
			case (SUMMER):	CreateOutputRec(dailyWeaRec, summerOut)
								ComputeStats(dailyWeaRec, curYearStats, summerStats)
			case (FALL):	CreateOutputRec(dailyWeaRec, fallOut)
								ComputeStats(dailyWeaRec, curYearStats, fallStats)

		Readfiles(tempData, atmData, precData, dailyWeaRec, validate)
	endwhile;

	if (validDate)  // as long as invalid dates did not cause loop exit
		OutputStats (curSeason, curYearStats, winterStats, springStats,
							summerStats, fallStats);

	CloseFiles(tempData, atmData, precData, winterOut, springOut, summerOut,
					fallout);

	return 0;
}

void ReadyFiles(ifstream& tempData, ifstream& atmData, ifstream& precData,
					ofstream& winterOut, ofstream& springOut, 
					ofstream& summerOut, ofstream& fallOut);

// This function prepares the input and output files for use
// Precondition:  none
// Postcondition:  an attempt has been made to open the files, if an error
//                 has occurred, the stream will be in a failed state which
//                 can be checked in the function that called this function

	cout << "input the temperature file " << endl;//prompt user for temperature file
	getline(cin, tempData); //read temp file name
	file.open(tempData.c_str());//open temp file

	cout << "input the atmosphere file " << endl;
	getline(cin, atmData);
	file.open(atmData.c_str());
    //prompt user for atmosphere file
	//read atmos file name
	//open atmos file

	cout << "input the precipitation file " << endl;
	getline(cin, precData);
	file.open(precData.c_str());
    
    //prompt user for precipitation file
	//read precip file name
	//open precip file
    //V use file.open(filename.c_str()) on these
 file.open(winterOut.c_str());
 file.open(springOut.c_str());
 file.open(summerOut.c_str());
 file.open(fallOut.c_str());

	return;


void 	ReadData(ifstream& tempData, ifstream& atmData, ifstream& precData,
					WeatherData& dailyWeaRec, bool& validDate)

// This function reads the values from the input files into the daily weather
// record and checks to make sure the dates match in all three file records
// Precondition:  The streams have been successfully opened
// Postcondition:  The daily weather record contains data from all three
//                 files if the dates match and the Boolean validDate is true
//                 otherwise, if the dates don’t match, validDate is set to 
//                 false

//V turn into actual code~~!!!!!!!
	read tempDate
	read atmDate
	read precDate

	if (tempDate == atmDate) and (atmDate == precDate))
		read fields from files into dailyWeaRec members
		set validDate to true
	else
		cout << "print dates don't match message to screen" << endl;
		set validDate to false
	return;



this is the errors i get

Program1.cpp: In function ‘int main()’:
Program1.cpp:72:81: error: ‘ReadyFiles’ was not declared in this scope
ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout);
^
Program1.cpp:74:9: error: expected primary-expression before ‘=’ token
if (=!ReadyFiles){
^
Program1.cpp:76:8: error: ‘exit_code’ was not declared in this scope
exit(exit_code);
^
Program1.cpp:76:17: error: ‘exit’ was not declared in this scope
exit(exit_code);
^
Program1.cpp:79:63: error: ‘ReadFiles’ was not declared in this scope
ReadFiles(tempData, atmData, precData, dailyWeaRec, validDate);
^
Program1.cpp:81:18: error: expected ‘)’ before ‘not’ token
while (tempData not eof and validDate);
^
Program1.cpp:81:22: error: ‘eof’ was not declared in this scope
while (tempData not eof and validDate);
^
Program1.cpp:83:43: error: ‘CheckNewYear’ was not declared in this scope
newYear = CheckNewYear (dailyWeaRec.date) //have I encountered a new year
^
Program1.cpp:110:30: error: ‘OutputStats’ was not declared in this scope
summerStats, fallStats);
^
Program1.cpp:113:13: error: ‘CloseFiles’ was not declared in this scope
fallout);
^
Program1.cpp: At global scope:
Program1.cpp:128:2: error: ‘cout’ does not name a type
cout << "input the temperature file " << endl;//prompt user for temperature file
^
Program1.cpp:129:9: error: expected constructor, destructor, or type conversion before ‘(’ token
getline(cin, tempData); //read temp file name
^
Program1.cpp:130:2: error: ‘file’ does not name a type
file.open(tempData.c_str());//open temp file
^
Program1.cpp:132:2: error: ‘cout’ does not name a type
cout << "input the atmosphere file " << endl;
^
Program1.cpp:133:9: error: expected constructor, destructor, or type conversion before ‘(’ token
getline(cin, atmData);
^
Program1.cpp:134:2: error: ‘file’ does not name a type
file.open(atmData.c_str());
^
Program1.cpp:139:2: error: ‘cout’ does not name a type
cout << "input the precipitation file " << endl;
^
Program1.cpp:140:9: error: expected constructor, destructor, or type conversion before ‘(’ token
getline(cin, precData);
^
Program1.cpp:141:2: error: ‘file’ does not name a type
file.open(precData.c_str());
^
Program1.cpp:147:2: error: ‘file’ does not name a type
file.open(winterOut.c_str());
^
Program1.cpp:148:2: error: ‘file’ does not name a type
file.open(springOut.c_str());
^
Program1.cpp:149:2: error: ‘file’ does not name a type
file.open(summerOut.c_str());
^
Program1.cpp:150:2: error: ‘file’ does not name a type
file.open(fallOut.c_str());
^
Program1.cpp:152:2: error: expected unqualified-id before ‘return’
return;
^
Program1.cpp:167:2: error: expected initializer before ‘read’
read tempDate
^
Program1.cpp:176:3: error: ‘set’ does not name a type
set validDate to false
Start from the first error:
Program1.cpp: In function ‘int main()’:
Program1.cpp:72:81: error: ‘ReadyFiles’ was not declared in this scope
ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout);^

The compiler essentially reads line by line and remembers what it has seen.
On that line it sees ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout); and within it is a word ReadyFiles.

What is ReadyFiles? That word has not been seen before. This line might be a function call, so the variables within parentheses are probably arguments to function, but the compiler cannot check whether the types are correct for the ReadyFiles, because it has not been told (yet) that ReadyFiles is a function and what arguments does it expect.

A function has to be declared before it can be called.


Program1.cpp:74:9: error: expected primary-expression before ‘=’ token
if (=!ReadyFiles){
^

You have a condition expression, where there is operator =. The right side operand of the operator is !ReadyFiles, but on the left side of the = there is nothing. The '=' is a binary operator. It does require two operands.
Line 69,76: These are not valid function prototypes. Function prototypes should specify the type of each argument, not variable names. They should go before main.
1
2
bool ReadyFiles (ifstream & tempData, ifstream & atmData, ifstream & precData, ofstream & winterOut, ofstream & springOut, ofstream & summerOut, ofstream & fallout);
void ReadFiles (ifstream & tempData, ifstream & atmData, ifstream & precData, WeatherData & dailyWeaRec, bool validDate);


You have no implementation for ReadFiles.

Line 71: This is not a valid function call/if statement. Should be:
 
if (! ReadyFiles(tempData,atmData,precData,winterOut,springOut,summerOut,fallout))


Line 73: exit_code is undefined.

Line 78: This condition makes no sense (not valid syntax).

Line 78: Do not loop on !eof(). This does not work the way you expect. The eof bit is set true only after you make a read attempt on the file. This means after you read the last record of the file, eof is still false. Your attempt to read past the last record sets eof, but you're not checking it there. You proceed as if you had read a good record. This will result in reading an extra (bad) record. The correct way to deal with this is to put the >> operation as the condition in the while statement.
1
2
3
  while (cin >> var) 
  {  //  Good cin or istream operation
  }


Line 80: No ;

Line 80: CheckNewYear() is not defined.

There are lots more errors. You need to start with the first error. Correct that, then move on to the next error. If you don't understand a specific error, post back.


Last edited on
new errors

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
47
48
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../         include/c++/4.4.7/array:35,
                 from Program1.cpp:8:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/c++0         x_warning.h:31:2: error: #error This file requires compiler and library s         upport for the upcoming ISO C++ standard, C++0x. This support is currentl         y experimental, and must be enabled with the -std=c++0x or -std=gnu++0x c         ompiler options.
Program1.cpp: In function ‘int main()’:
Program1.cpp:72: error: redeclaration of ‘int tempData’
Program1.cpp:71: error: ‘int tempData’ previously declared here
Program1.cpp:72: error: redeclaration of ‘int atmData’
Program1.cpp:71: error: ‘int atmData’ previously declared here
Program1.cpp:72: error: redeclaration of ‘int precData’
Program1.cpp:71: error: ‘int precData’ previously declared here
Program1.cpp:73: error: redeclaration of ‘int ReadyFiles’
Program1.cpp:71: error: ‘int ReadyFiles’ previously declared here
Program1.cpp:73: error: expected initializer before ‘&’ token
Program1.cpp:76: error: conflicting declaration ‘WeatherData dailyWeaRec’
Program1.cpp:72: error: ‘dailyWeaRec’ has a previous declaration as ‘int          dailyWeaRec’
Program1.cpp:80: error: conflicting declaration ‘std::ifstream tempData’
Program1.cpp:71: error: ‘tempData’ has a previous declaration as ‘int tem         pData’
Program1.cpp:80: error: conflicting declaration ‘std::ifstream atmData’
Program1.cpp:71: error: ‘atmData’ has a previous declaration as ‘int atmD         ata’
Program1.cpp:80: error: conflicting declaration ‘std::ifstream precData’
Program1.cpp:71: error: ‘precData’ has a previous declaration as ‘int pre         cData’
Program1.cpp:81: error: conflicting declaration ‘std::ofstream winterOut’
Program1.cpp:71: error: ‘winterOut’ has a previous declaration as ‘int wi         nterOut’
Program1.cpp:81: error: conflicting declaration ‘std::ofstream springOut’
Program1.cpp:71: error: ‘springOut’ has a previous declaration as ‘int sp         ringOut’
Program1.cpp:81: error: conflicting declaration ‘std::ofstream summerOut’
Program1.cpp:71: error: ‘summerOut’ has a previous declaration as ‘int su         mmerOut’
Program1.cpp:81: error: conflicting declaration ‘std::ofstream fallout’
Program1.cpp:71: error: ‘fallout’ has a previous declaration as ‘int fall         out’
Program1.cpp:82: error: conflicting declaration ‘bool validDate’
Program1.cpp:72: error: ‘validDate’ has a previous declaration as ‘int va         lidDate’
Program1.cpp:86: error: ‘ReadyFiles’ cannot be used as a function
Program1.cpp:88: error: ‘ReadyFiles’ cannot be used as a function
Program1.cpp:91: error: ‘exit_code’ was not declared in this scope
Program1.cpp:91: error: ‘exit’ was not declared in this scope
Program1.cpp:94: error: ‘ReadFiles’ cannot be used as a function
Program1.cpp:96: error: expected ‘)’ before ‘!’ token
Program1.cpp:96: error: ‘eof’ was not declared in this scope
Program1.cpp:96: error: expected ‘;’ before ‘)’ token
Program1.cpp:108: error: request for member ‘date’ in ‘dailyWeaRec’, whic         h is of non-class type ‘int’
Program1.cpp:108: error: ‘ProcessSeason’ was not declared in this scope
Program1.cpp:110: error: expected ‘;’ before ‘switch’
Program1.cpp:125: error: ‘OutputStats’ was not declared in this scope
Program1.cpp:128: error: ‘CloseFiles’ was not declared in this scope
Program1.cpp: At global scope:
Program1.cpp:137: error: expected unqualified-id before ‘{’ token
Program1.cpp:162: error: expected unqualified-id before ‘{’ token
[18:36] s425497m@cslab100:~/fall2016 $
new code i tried to fix what you said. but i'm not sure if i'm doing this right.

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

//PUT SEMICOLONS ON WHERE THEY NEED TO BE~!!!!

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <array>
#include <istream>

using namespace std;

int ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout);
int ReadFiles(tempData, atmData, precData, dailyWeaRec, validDate);
int ReadyFiles(ifstream& tempData, ifstream& atmData, ifstream& precData, ofstream& winterOut, ofstream& springOut, ofstream& summerOut, ofstream& fallOut);


enum Season {WINTER, SPRING, SUMMER, FALL};

struct WeatherData		// Holds weather data from all three files
{
	string date;			// Date of observation
	int highTemp;			// High temperature recorded
	int lowTemp;			// Low temperature recorded
	int avgTemp;			// Average temperature for date
	int departNorm;		    // Departure from normal temperature
	int avgDP;				// Average dew point for the date
	int avgRH;				// Average relative humidity for the date
	int avgWind;			// Average wind speed recorded for the date
	float avgPress;		    // Average barometric pressure for the date
	float totPrecip;		// Total precipitation for the date, (-1 if none)
	int noObs;				// Number of observations taken for the date
};

struct YearStats			// Holds the yearly totals, highs, lows for summary
{
	int highTemp;			// Highest temp encountered for year so far
	string highTempDate;	// Date of highest temp encountered
	int lowTemp;			// Lowest temp encountered for year so far
	string lowTempDate;	// Date of the lowest temp encountered
	float highPrecip;		// Highest precipitation encountered for year so far
	string highPrecDate;	// Date of highest precipitation encountered
	int totHigh;			// Accumulator for high temperatures
	int totLow;				// Accumulator for low temperatures
	int totDP;				// Accumulator for dew points
	int totRH;				// Accumulator for relative humidities
	int totWind;			// Accumulator for wind speeds
	float totPress;		    // Accumulator for barometric pressures
	float totPrecip;		// Accumulator for precipitation
	int obsCnt;				// Counter of number of dates for averages
};

struct SeasonStats		// Holds the season totals for summary
{
	int totHigh;			// Accumulator for high temperatures
	int totLow;				// Accumulator for low temperatures
	int totDP;				// Accumulator for dew points
	int totRH;				// Accumulator for relative humidities
	int totWind;			// Accumulator for wind speeds
	float totPress;		    // Accumulator for barometric pressures
	float totPrecip;		// Accumulator for precipitation
	int obsCnt;				// Counter of number of dates for averages
};





int main()
{
   
    
	WeatherData dailyWeaRec;
	Season curSeason;
	YearStats curYearStats;
	SeasonStats winterStats, springStats, summerStats, fallStats;
	ifstream tempData, atmData, precData;
	ofstream winterOut, springOut, summerOut, fallout;
	bool validDate = true;
	bool firstRec = true;
	bool newYear;

	ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout);
	//V change to actual code
    if (!ReadyFiles(tempData, atmData, precData, winterOut, springOut, summerOut,fallout))
    {
		cout << "print error message to screen";
		exit(exit_code);
    }

	ReadFiles(tempData, atmData, precData, dailyWeaRec, validDate);

	while (tempData not eof and validDate){
       
		newYear = CheckNewYear (dailyWeaRec.date)  //have I encountered a new year
		if (newYear)
			if (firstRec)   // I will get a new year for first record, but don’t 
				firstRec = false  // print stats  
			else
				OutputStats(curSeason,curYearStats, winterStats, springStats,
					summerStats, fallStats)
			ResetStats(dailyWeaRec, curYearStats, winterStats, springStats,
					summerStats, fallStats)}

		curSeason = ProcessSeason(dailyWeaRec.date)

		switch (curSeason)
 			case (WINTER):	CreateOutputRec(dailyWeaRec, winterOut)
								ComputeStats(dailyWeaRec, curYearStats, winterStats)
			case (SPRING):	CreateOutputRec(dailyWeaRec, springOut)
								ComputeStats(dailyWeaRec, curYearStats, springStats)
			case (SUMMER):	CreateOutputRec(dailyWeaRec, summerOut)
								ComputeStats(dailyWeaRec, curYearStats, summerStats)
			case (FALL):	CreateOutputRec(dailyWeaRec, fallOut)
								ComputeStats(dailyWeaRec, curYearStats, fallStats)

		Readfiles(tempData, atmData, precData, dailyWeaRec, validate)
	endwhile;

	if (validDate){  // as long as invalid dates did not cause loop exit
		OutputStats (curSeason, curYearStats, winterStats, springStats,
							summerStats, fallStats);
    }
	CloseFiles(tempData, atmData, precData, winterOut, springOut, summerOut,
					fallout);
    
	return 0;

}

void ReadyFiles(ifstream& tempData, ifstream& atmData, ifstream& precData,
					ofstream& winterOut, ofstream& springOut, 
					ofstream& summerOut, ofstream& fallOut);
{

	cout << "input the temperature file " << endl;
	getline(cin, tempData); 
	file.open(tempData.c_str());

	cout << "input the atmosphere file " << endl;
	getline(cin, atmData);
	file.open(atmData.c_str());
 
	cout << "input the precipitation file " << endl;
	getline(cin, precData);
	file.open(precData.c_str());
    
 file.open(winterOut.c_str());
 file.open(springOut.c_str());
 file.open(summerOut.c_str());
 file.open(fallOut.c_str());

	return;
}

void 	ReadData(ifstream& tempData, ifstream& atmData, ifstream& precData,
					WeatherData& dailyWeaRec, bool& validDate);

{
//V turn into actual code~~!!!!!!!
	read tempDate
	read atmDate
	read precDate

	if (tempDate == atmDate) and (atmDate == precDate)){
        
		read fields from files into dailyWeaRec members
		set validDate to true
    }
    {else
		cout << "print dates don't match message to screen" << endl;
		set validDate to false
    }


	return;
}

 
Line 13 should be a function declaration, but it does not state the types of the arguments. Besides, the same function is apparently declared on line 15 too.

Line 14 should be a function declaration, but it does not state the types of the arguments.

Function declared on line 15 returns int, but function implementation on lines 131-154 returns void.

You seem to call the same function on lines 83 and 85.
The call on line 85 uses the value returned by the function for boolean test.

The ReadyFiles has a mysterious identifier file that is not explained anywhere.

What do you do on line 137?
What do you do on line 138?
http://www.cplusplus.com/forum/beginner/198305/

please keep your this problem to this thread only.....
new errors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Program1.cpp:27: error: expected ‘,’ or ‘...’ before ‘int’
Program1.cpp:357: error: expected ‘,’ or ‘...’ before ‘int’
Program1.cpp: In function ‘void switchStatement(int, int, int)’:
Program1.cpp:357: error: new declaration ‘void switchStatement(int, int, int)’
Program1.cpp:27: error: ambiguates old declaration ‘int switchStatement(int, int  , int)’
Program1.cpp:359: error: ‘curSeason’ was not declared in this scope
Program1.cpp:361: error: ‘dailyWeaRec’ was not declared in this scope
Program1.cpp:361: error: ‘winterOut’ was not declared in this scope
Program1.cpp:361: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:362: error: ‘curYearStats’ was not declared in this scope
Program1.cpp:362: error: ‘winterStats’ was not declared in this scope
Program1.cpp:362: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:365: error: ‘springOut’ was not declared in this scope
Program1.cpp:365: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:366: error: ‘springStats’ was not declared in this scope
Program1.cpp:366: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:369: error: ‘summerOut’ was not declared in this scope
Program1.cpp:369: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:370: error: ‘summerStats’ was not declared in this scope
Program1.cpp:370: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:373: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:374: error: ‘fallStats’ was not declared in this scope
Program1.cpp:374: error: ‘ComputeStats’ cannot be used as a function
Last edited on
paste bin link to the code

http://pastebin.com/XY7LZmeX
new errors

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Program1.cpp: In function ‘void switchStatement(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)’:
Program1.cpp:360: error: ‘WINTER’ cannot appear in a constant-expression
Program1.cpp:361: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:362: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:364: error: ‘SPRING’ cannot appear in a constant-expression
Program1.cpp:365: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:366: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:368: error: ‘SUMMER’ cannot appear in a constant-expression
Program1.cpp:369: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:370: error: ‘summerStats’ was not declared in this scope
Program1.cpp:370: error: ‘ComputeStats’ cannot be used as a function
Program1.cpp:372: error: ‘FALL’ cannot appear in a constant-expression
Program1.cpp:373: error: ‘CreateOutputRec’ cannot be used as a function
Program1.cpp:374: error: ‘ComputeStats’ cannot be used as a function
I don;t have access to pastebin from this machine. My comments are to your previous post.

Line 13: keskiverto already pointed out the problem with this line. In fact this line is not needed. It is superseded by line 15.

Line 14 has the same problem. You're giving argument names, not types. Function prototypes need to have the types of their arguments. This was pointed out before.

Line 14: The return type of the function prototype does not match the implementation.

Line 82: Why is this line here? You repeat the line at line 85.

Edit:
Line 14: Since this functon prototype references WeatherData, it must appear AFTER the declaration of WeatherData. Move your function prototypes to line 65.

Line 85: You use ReadyFiles as a bool expression, but ReadyFiles is a void function.

Line 88: exit_code is undefined. I pointed this out before.

Line 93: This is not valid syntax. I also pointed this out before.

Line 95: CheckNewYear() is not defined anywhere. I pointed this out before.

Line 95,98,101,103,105,108-117: No ;

Line 100: OutputStats() not defined.

Line 102: ResetStats() not defined

Line 103: What does the } terminate? It terminates your while loop, but that does not appear to be what you intended.

Line 105: ProcessSeason() not defined.

108-115: Your switch statement needs break; for each case.

Lines 108-116: The cases in your switch statement must be enclosed in {}

Lines 108,110,112,114: CreateOutputRec() not defined.

Lines 109,111,111,113: ComputeStats() not defined.

Line 114: Capitalization error on fallOut. Should be fallout (see line 78).

Line 117: Spelling error on validate. Should be validDate.

Line 117: Capitialization error on Readfiles. Should be ReadFiles.

Line 118: There is no endwhile statement in C++. Use } to terminate your while loop.

Line 124: CloseFiles() is undefined.

Line 133,157: Function headers do not have a ; Remove it.

Line 137,141,145: You can;t do a getline() to an ifstream. You have to do a getline() to a string.

Lines 138,142,146. ifstream does not have a c_str() member.

Lines 148-151: ofstream does not have a c_str() member.

Lines 161-163,167,168,172: These are not valid statements.

If you're not going to fix the errors I've already pointed out, there is little point in my helping you further.

You need to learn how to fix the errors the compiler tells you. Start with the first error. Fix that. Compile again and then fix the next error.









Last edited on
Topic archived. No new replies allowed.