Thread: [Dev-C++] 'string' was not declared in this scope
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Flavio de S. <fla...@ya...> - 2003-11-26 01:10:31
|
I am trying to compile my program and I got an error: 'string' was not declared in this scope Even if I put in the file #include <string> What is happing? See following my file header: #ifndef MAX_REPLY_LENGTH #define MAX_REPLY_LENGTH 512 #endif #ifndef CRLF #define CRLF \r\n #endif #ifndef MAX_COMMAND_LENGTH #define MAX_COMMAND_LENGTH 64 #endif #ifndef MAX_RECEIPT_BUFFER_SIZE #define MAX_RECEIPT_BUFFER_SIZE 8192 #endif //The stat command reply informs the number of messages and the size of mailbox #ifndef NUMBER_OF_STAT_REPLY_WORDS #define NUMBER_OF_STAT_REPLY_WORDS 3 //The reply to STAT command will give 3 words only #endif #ifndef POP3_h #define POP3_h #include <string> #include "SocketConnection.h" //Maybe can occur errors here. class POP { public: POP(); virtual ~POP(); //-------------------------------- // POP Commands - AUTHORIZATION //-------------------------------- int sendUser (); int sendPASS (); int sendQUIT (); //-------------------------------- // POP Commands - TRANSACTION //-------------------------------- int sendSTAT (); int sendLIST (); int sendLIST ( unsigned int Msg ); int sendRETR ( unsigned int Msg ); int sendDELE ( unsigned int Msg ); int sendNOOP (); int sendRSET (); //-------------------------------- // Optional POP3 Commands //-------------------------------- int sendAPOP ( unsigned int Msg ); //valid in the AUTHORIZATION state int sendTOP ( unsigned int Msg ); //valid in the TRANSACTION state int sendUIDL (); //valid in the TRANSACTION state /* Note that with the exception of the STAT, LIST, and UIDL commands, the reply given by the POP3 server to any command is significant only to "+OK" and "-ERR". Any text occurring after this reply may be ignored by the client. */ int setPort ( int Port = 110 ); int setServerHost ( string ServerHost ); int setTimeOut ( unsigned int TimeOut = 30); int setUserName ( string User ); int setPassword ( string Password); int getPortNumber(); string getServerHostName(); unsigned int getTimeOut (); string getHostReply(); unsigned int getMailboxSize(); unsigned int getTotalMessages(); unsigned int getCurrentMessageSize(); unsigned int getCurrentMessageNumber(); private: SocketConnection _connection; //Socket object to stabilish connection bool _connectionUp; //Inform if connection is still Ok string _receiverBuffer;//Receive reply from POP server int _port; string _serverHost; string _user; string _password; unsigned int _timeOut; //Max waiting time in miliseconds unsigned int _statusIndicator; //It holds 1 if response is "+OK" and 0 if response is "-ERR" unsigned int _totalOfMessages; //Holds the total of messages in one session to download. unsigned int _sizeOfMailbox; //Holds the size of the mailbox unsigned int _sizeCurrentMessage; unsigned int _currentMessage; int _connect(); //Method that connects the socket int _sendCommand( const char *Command ); //Send POP command }; #endif // POP3_h --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.543 / Virus Database: 337 - Release Date: 21/11/2003 |
From: P.D. v. Z. <pa...@my...> - 2003-11-26 03:23:29
|
Everything from the standard C++ library should be (and in GCC it is) in the standard namespace ("std"). You need to either import string into the current namespace, or qualify the name explicitly. In other words, either use: using std::string; or replace all your string variables from "string" to "std::string". And while you're at it, read up on the C++ standard (especially namespaces) :) Regards, Paul -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Flavio de Souza Sent: Wednesday, November 26, 2003 8:13 AM To: dev...@li... Subject: [Dev-C++] 'string' was not declared in this scope I am trying to compile my program and I got an error: 'string' was not declared in this scope Even if I put in the file #include <string> What is happing? See following my file header: #ifndef MAX_REPLY_LENGTH #define MAX_REPLY_LENGTH 512 #endif #ifndef CRLF #define CRLF \r\n #endif #ifndef MAX_COMMAND_LENGTH #define MAX_COMMAND_LENGTH 64 #endif #ifndef MAX_RECEIPT_BUFFER_SIZE #define MAX_RECEIPT_BUFFER_SIZE 8192 #endif //The stat command reply informs the number of messages and the size of mailbox #ifndef NUMBER_OF_STAT_REPLY_WORDS #define NUMBER_OF_STAT_REPLY_WORDS 3 //The reply to STAT command will give 3 words only #endif #ifndef POP3_h #define POP3_h #include <string> #include "SocketConnection.h" //Maybe can occur errors here. class POP { public: POP(); virtual ~POP(); //-------------------------------- // POP Commands - AUTHORIZATION //-------------------------------- int sendUser (); int sendPASS (); int sendQUIT (); //-------------------------------- // POP Commands - TRANSACTION //-------------------------------- int sendSTAT (); int sendLIST (); int sendLIST ( unsigned int Msg ); int sendRETR ( unsigned int Msg ); int sendDELE ( unsigned int Msg ); int sendNOOP (); int sendRSET (); //-------------------------------- // Optional POP3 Commands //-------------------------------- int sendAPOP ( unsigned int Msg ); //valid in the AUTHORIZATION state int sendTOP ( unsigned int Msg ); //valid in the TRANSACTION state int sendUIDL (); //valid in the TRANSACTION state /* Note that with the exception of the STAT, LIST, and UIDL commands, the reply given by the POP3 server to any command is significant only to "+OK" and "-ERR". Any text occurring after this reply may be ignored by the client. */ int setPort ( int Port = 110 ); int setServerHost ( string ServerHost ); int setTimeOut ( unsigned int TimeOut = 30); int setUserName ( string User ); int setPassword ( string Password); int getPortNumber(); string getServerHostName(); unsigned int getTimeOut (); string getHostReply(); unsigned int getMailboxSize(); unsigned int getTotalMessages(); unsigned int getCurrentMessageSize(); unsigned int getCurrentMessageNumber(); private: SocketConnection _connection; //Socket object to stabilish connection bool _connectionUp; //Inform if connection is still Ok string _receiverBuffer;//Receive reply from POP server int _port; string _serverHost; string _user; string _password; unsigned int _timeOut; //Max waiting time in miliseconds unsigned int _statusIndicator; //It holds 1 if response is "+OK" and 0 if response is "-ERR" unsigned int _totalOfMessages; //Holds the total of messages in one session to download. unsigned int _sizeOfMailbox; //Holds the size of the mailbox unsigned int _sizeCurrentMessage; unsigned int _currentMessage; int _connect(); //Method that connects the socket int _sendCommand( const char *Command ); //Send POP command }; #endif // POP3_h --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.543 / Virus Database: 337 - Release Date: 21/11/2003 ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |