function declaration with string argument does not work in header file

Hi guys,

Could you please help me with one beginner problem ?

How I can declare function with string argument in header file. I created this code but compiler (MS VC++ 8) throws error

'string' : undeclared identifier

Code is:
******************************
#include <string>

void fnc1(string a);
void f2(string&);
void f3(string*)
******************************

I am in doubts what is the problem.

Cheers,

Mike
point namespace std;

add std:: before string anywhere

for example std::string a


and please consider passing parameter via const reference
Thank you Denis,

It's working. I forgot that when I am not writing "using namespace std" in header I have to point to it in declarations.

Mike
Topic archived. No new replies allowed.