This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Syntax Problem


string lives in namespace std.

Try a replace all of "string" with "std::string"

Brian

On 10/26/06, Joe Hayes <joe_squid@sbcglobal.net> wrote:
I have a header file defined as follows:



//commodity.h

#include <string>



#ifndef COMMODITY_H

#define COMMODITY_H

class Commodity

{

long commId;

string description;

string manufacturerId;



public:

Commodity(void);

Commodity(long cId, string descrip, string mfgId);

void setCommodityId(long cId);

void setDescription(string descrip);

void setManufacturerId(string mfgId);

long getCommodityId(void);

string getDescription(void);

string getManufacturerId(void);

};

#endif



And I have another file that makes use of this header file:



//driver.cpp

#include "commodity.h"

int main()

{

return 0;

}



But when I try to compile, I receive the error:



syntax error : missing ';' before identifier 'description



Along with many other errors. I have tried everything I can think of, and I
still cannot find the error...any suggestions?





Thanks for your help,

Joe



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]