0

I'm having a hard time understanding why I get an error when I try to compile this. Do I need to post my main too?

#ifndef SEARCHABLEADT_H
#define SEARCHABLEADT_H

#include <string>

template <typename T>
class SearchableADT
{
public:
    virtual int loadFromFile(string filename) = 0;
    //virtual void clear(void) = 0;
    virtual void insertEntry(T value) = 0;
    virtual void deleteEntry(T value) = 0;
    virtual bool isThere(T value) = 0;
    virtual int numEntries(void) = 0;
};
#endif

error is: c:\users****\documents\visual studio 2012\projects\headersearchableadt\headersearchableadt\searchableadt.h(10): error C2061: syntax error : identifier 'string'

2
  • 2
    Observe the power of Clang! Commented Jul 24, 2014 at 0:42
  • 1
    You should using std::string or other methods to import string. Commented Jul 24, 2014 at 0:43

2 Answers 2

2

You could also use the next declaration:

#include <string>
using namespace std;

Although some one could argue that that's a bad coding habit.

Sign up to request clarification or add additional context in comments.

Comments

0

Try: virtual int loadFromFile(std::string filename) = 0;.
Note the std::.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.