This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Help - std::string
use #include <string>
On Mon, 11 Aug 2003 07:56:20 -0700
"Jim Gifford" <jim@jg555.com> wrote:
>Here is the error message I receive. What am I doing wrong??
>
>make all-am
>make[1]: Entering directory `/usr/src/cone-0.52/maildir'
>Compiling maildirsearch.c
>Compiling maildirsearchC.cpp
>In file included from maildirsearchC.cpp:7:
>maildirsearch.h:95: error: syntax error before `;' token
>maildirsearch.h:97: error: syntax error before `;' token
>maildirsearch.h:103: error: `string' undeclared in namespace `std'
>maildirsearch.h:103: error: parse error before `)' token
>maildirsearch.h: In member function `int mail::Search::setString(...)':
>maildirsearch.h:105: error: `String' undeclared (first use this function)
>maildirsearch.h:105: error: (Each undeclared identifier is reported only
>once
> for each function it appears in.)
>maildirsearch.h:105: error: `s' undeclared (first use this function)
>make[1]: *** [maildirsearchC.o] Error 1
>make[1]: Leaving directory `/usr/src/cone-0.52/maildir'
>make: *** [all] Error 2
>
>Code
>#include <string.h>
>
>namespace mail {
>
>class Search {
>
> struct maildir_searchengine sei;
>
> std::string String;
>
> std::vector<unsigned> rbuf;
>
> public:
> Search();
> virtual ~Search();
>
> int setString(std::string s)
> {
> String=s;
> return maildir_search_start(&sei, s.c_str());
> }
>
> void reset()
> {
> maildir_search_reset(&sei);
> }
>
>
> void operator<<(char c) { maildir_search_step(&sei, c); }
>
> operator bool() { return maildir_search_found(&sei); }
>
> bool operator !() { return ! operator bool(); }
>
> private:
> Search(const Search &); // UNDEFINED
>
> Search &operator=(const Search &); // UNDEFINED
>
>};
>
>