Function Error Message

This is a homework assignment - please do not give me code.

I wrote this program:
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
#include <iostream>

using namespace std;

int main()  

{ 

string fileName;
ifstream inf;

openFile(inf, fileName);

countL(inf);
	
inf.close();
inf.clear();

return 0 ;
}
//*************************openFile********************************************
//  Name: 		openFile
//  Description: 	opens file
//  Parameters: 	ifstream& inf
//			fileN catches fileName
//  Return: 		none
//****************************************************************************
void openFile(ifstream& inf, string fileN) {
	cout << "Please enter file name:" << endl;
	cin >> fileN;

	inf.open(fileN.c_str());
	
	if (inf.is_open()) 
	    cout << "File is open." << endl;
	
	else {
    		cerr << "File not found - terminating." << endl;
    		abort();
	}
}


This is the error message I am getting:

Undefined first referenced
symbol in file
countL(std::basic_ifstream<char, std::char_traits<char> >&)/var/tmp//ccVWijSX.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status


I see that the error message is telling me to look in the function countL, and I have looked several times to make sure there are no spelling errors, etc., but am still not sure why I am getting this error.

Thanks in advance.
Last edited on
Nevermind - just realized that if a function is passing something, you can't use void. DUH. Will try fixing that and post back.
The declaration of the function

void countL(ifstream&);

and its definition

void countL(ifstream& inf, int charNum, int lineNum)

do not correspond each other.
Last edited on
Thank you.
Topic archived. No new replies allowed.