Tuesday, July 14, 2009

Compile errors in my header file? why? c++?

before in my header file i had this:


File Edit Options Buffers Tools C++ Help


#ifndef SWAP_H


#define SWAP_H


//#include %26lt;string%26gt;


//#include %26lt;iostream%26gt;


using namespace std;





void swap (string %26amp;, string %26amp;);





#endif


-------


that gave me these compile errors:


Swap.h:7: error: `string' was not declared in this scope


Swap.h:7: error: parse error before `,' token


------


now i have:


#ifndef SWAP_H


#define SWAP_H


//#include %26lt;string%26gt;


//#include %26lt;iostream%26gt;


using namespace std;





std::void swap (string %26amp;, string %26amp;);


#endif


------


Swap.h:7: error: `string' was not declared in this scope


Swap.h:7: error: parse error before `,' token


---


ALL this happens when i try to compile my Swap.cpp file.. help? wats wrong?

Compile errors in my header file? why? c++?
The compiler doesn't know what a "string" is.





uncomment the #include %26lt;string%26gt; and add


using std::string;


No comments:

Post a Comment