Click to See Complete Forum and Search --> : Code will compile in Borland but not Visual C++ 6.0


barbes
October 29th, 2002, 09:42 PM
Hi,
Got a program that will compile in the Borland command line compiler, however when I try to compile the same code in Visual, it comes up with errors. I know it has something to do with the header files used, but I don't know which ones to include when using Visual.

When using Borland works fine...



#include <STRING>
#include <DEQUE>
#include <VECTOR>
#include <algorithm>





class worker {
protected:
string name;
// Error message here: 'string' :missing storage-class or type specifiers

ozDate startDate;

public:
worker (string, ozDate*);
string getName() const;
ozDate getStartDate() const;
void showName(int) const;
void showStartDate() const;
virtual double showTotalPay(ozDate& inToday) const;
virtual void changeName(string inNewName);
virtual void displayType() const;
virtual void showExpiryDate() const;
virtual ozDate getExpiryDate() const;
};



Then use the same code in Visual and get errors, does anyone know what include file I should be using??

Regards Barbes

Philip Nicoletti
October 29th, 2002, 10:15 PM
I assume that this is in a header file, so :


std::string name;



In CPP files, you can :


using namspace std;


although some programmers prefer not to do
that even in cpp files.