i sloved the previous problem and got the new problem now, i have three file header file where i define the function prototype and the other implementaion file for the function body and other one is the test file which takes input for the implementation file
i have a function

void search_s(srch,status);
srch and status are both input using the getline and srch is string and status is bool
so i got the compilation error stating
no matching function for call to `getline(std::istream&, bool&, char)'

so what is possible reason for it ,,
i have the header file - fucntion prototype define as
void search_s(std::string, bool& status)

Recommended Answers

All 9 Replies

>no matching function for call to `getline'
You probably forgot to include <string>.

i have the include<string>
and i have the similar function search_f(srch)
and it works but when i tried to use it with the bool variable input initally declared as bool status =false; , it gives the error

Wait, have you defined your own getline function? Those parameters don't match the standard getline function, which means you're either calling it incorrectly (if you meant to use the standard getline), or you're using a custom getline function but forgot to define it. Without seeing your code, I can't begin to guess.

NO, getline syntax is below
getline(cin,stat,'\n');
cl.search_s(srch, stat);
the above getline is the error generated by the g++ compiler
the stat is defined as void search_s(string srch,bool& stat) as the fucntion prototype in the header file

Member Avatar for iamthwee

Post more than three lines of code dummy. You have been told this before.
http://www.daniweb.com/forums/thread91144.html

How do we know whether your custom class definitions are working correctly.

Magic? Intuition?

cout << "get the search string for list";
cin.ignore(2,'\n');
getline(cin,srch,'\n');
cout << "get the new status for the list";
cin.ignore(2,'\n');
getline(cin,stat,'\n');
cl.search_s(srch, stat);
break;

How do you define stat and srch?

stat is the bool
and srch is the string

>stat is the bool
Okay then, can you tell me how you intend to read a string into a variable of type bool?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.