Syntax Problem

Brian Budge brian.budge@gmail.com
Thu Oct 26 19:51:00 GMT 2006


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
>



More information about the Gcc-help mailing list