CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    16

    Code will compile in Borland but not Visual C++ 6.0

    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...

    Code:
    #include <STRING>    
    #include <DEQUE>
    #include <VECTOR>
    #include <algorithm>
    Code:
    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

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725
    I assume that this is in a header file, so :

    Code:
    std::string name;

    In CPP files, you can :

    Code:
    using namspace std;
    although some programmers prefer not to do
    that even in cpp files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured