Re: Syntax Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



string lives in namespace std.

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

 Brian

On 10/26/06, Joe Hayes <joe_squid@xxxxxxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux