J
James
Can someone please help me with these errors?
#include <iostream>
#include <string>
class holder
{
private:
int vid;
string vtype;
public:
holder(int id, string str);
~holder();
int getvid();
void setvid(int id);
string gettype();
};
g++ -c -ansi -Wall -pedantic holder.cpp
In file included from holder.cpp:1:
holder.h:8: error: `string' does not name a type
holder.h:8: error: extra semicolon
holder.h:11: error: `string' has not been declared
holder.h:11: error: ISO C++ forbids declaration of `str' with no type
holder.h:15: error: `string' does not name a type
holder.h:15: error: extra semicolon
holder.cpp:3: error: `string' has not been declared
holder.cpp:4: error: ISO C++ forbids declaration of `str' with no type
holder.cpp: In constructor `holder::holder(int, int)':
holder.cpp:6: error: `vtype' undeclared (first use this function)
holder.cpp:6: error: (Each undeclared identifier is reported only once for
each function it appears in.)
holder.cpp: At global scope:
holder.cpp:24: error: `string' does not name a type
*** Error code 1
make: Fatal error: Command failed for target `holder.o'
#include <iostream>
#include <string>
class holder
{
private:
int vid;
string vtype;
public:
holder(int id, string str);
~holder();
int getvid();
void setvid(int id);
string gettype();
};
g++ -c -ansi -Wall -pedantic holder.cpp
In file included from holder.cpp:1:
holder.h:8: error: `string' does not name a type
holder.h:8: error: extra semicolon
holder.h:11: error: `string' has not been declared
holder.h:11: error: ISO C++ forbids declaration of `str' with no type
holder.h:15: error: `string' does not name a type
holder.h:15: error: extra semicolon
holder.cpp:3: error: `string' has not been declared
holder.cpp:4: error: ISO C++ forbids declaration of `str' with no type
holder.cpp: In constructor `holder::holder(int, int)':
holder.cpp:6: error: `vtype' undeclared (first use this function)
holder.cpp:6: error: (Each undeclared identifier is reported only once for
each function it appears in.)
holder.cpp: At global scope:
holder.cpp:24: error: `string' does not name a type
*** Error code 1
make: Fatal error: Command failed for target `holder.o'