I'm new to C++ but I can't figure out why this won't compile for me. I'm running on a Mac, coding with Xcode, but I'm building with my own makefile from bash.
Anyway, I'm getting two compiler errors that "string" type can't be found, even though I've included . Any help would be welcomed. Code:
//#include <string> // I've tried it here, too. I'm foggy on include semantics, but I think it should be safe inside the current preprocessor "branch"
#ifndef APPCONTROLLER_H
#define APPCONTROLLER_H
#include <string>
class AppController {
// etc.
public:
int processInputEvents(string input); //error: ‘string’ has not been declared
string prompt(); //error: ‘string’ does not name a type
};
#endif
I include this file in my main.cpp, and elsewhere in main I use the string type and it works just fine. Though in main I have included iostream instead of string (for other purposes). Yes, I've also tried including iostream in my AppController class but it didn't solve anything (I didn't really expect it to, either).
So I'm not really sure what the problem is. Any ideas?