470,634 Members | 2,077 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,634 developers. It's quick & easy.

"Error: Could not find a match for" is the bane of my existence right now


I am trying to write a program that opens a file; reads through it; outputs the text; then outputs the number of lines, words, and characters.

Problem is, every time I try to compile, no matter what modifications I make, I get an error, "line 42: Error: Could not find a match for std::basic_istream<char, std::char_traits<char>>::get(int)."

I have tried everything I can think of. Help?

#include <iostream>
#include <fstream>
using namespace std;

int algorithm(void);
int code(string);
int initialize(int&, int&, int&);
int processBlank(int&, char&);
int copyChar();
int printTotal();

int main(){

char ch;
string word, line;
int lcount, ccount, wcount;
int initialize();
// algorithm(); USED IN BUILD FILE
// code("text.cpp"); USED IN BUILD FILE
ifstream inFile;
processBlank(lcount, ch);
cout << "Lines: " << lcount << endl;
return 0;

int initialize(int &lcount, int &ccount, int &wcount){

lcount = 0;
ccount = 0;
wcount = 0;

return 0;

int processBlank(int &lcount, int &ch){

ifstream inFile;
while (! inFile.eof()){
inFile.get(ch); <---------------- Line in question
if (ch == '\n'){

return 0;
Feb 23 '08 #1
2 5392
9,208 Expert Mod 8TB
inFile.get() requires a char&. You do this inside processBlank() but the char& is passed in as an int&. Hence, the error.

Change processBlank() to have a char& argument instead of an int& argument and off you go.
Feb 23 '08 #2
Ah. Of course. How stupid of me.

Feb 23 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Saso Zagoranski | last post: by
1 post views Thread by =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post: by
2 posts views Thread by Jolie Chen | last post: by
2 posts views Thread by =?Utf-8?B?U3dhcHB5?= | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.