Reputation: 179
I am trying to create a program with a bunch of different classes. Somehow, despite the fact that #include < string>
has been used multiple times, I am still getting missing type specifier errors.
I have no idea where is is. Does anyone know where this problem might originate, or if not any steps I could take to try and debug this problem?
I'm sorry about the long post, I just didn't want to leave anything out.
main.cpp:
#include <iostream>
#include "ATP.cpp"
#include "AtlasObject.cpp"
#include "MAP.cpp"
#include "AtlasObjectFactory.cpp"
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
AtlasObject.cpp:
#ifndef ATLASOBJECT_CPP
#define ATLASOBJECT_CPP
#include <string>
class AtlasObject{
public:
virtual void create();
protected:
string uid;
string label;
int colorR;
int colorB;
int colorG;
char *data;
int isEncrypted;
void set_uid(string id);
void set_label(string l);
void set_color(int r, int b, int g);
void set_data(char* inData);
void set_isEncrypted(int encrypted);
string get_uid();
string get_label();
string get_color();
vchar* get_data();
int get_isEncrypted();
};
void AtlasObject::set_uid(string id) {}
void AtlasObject::set_label(string l) {}
void AtlasObject::set_color(int r, int b, int g) {}
void AtlasObject::set_data(char *inData) {}
void AtlasObject::set_isEncrypted(int encrypted) {}
string AtlasObject::get_uid() {}
string AtlasObject::get_label() {}
string AtlasObject::get_color() {}
char* AtlasObject::get_data() {}
int AtlasObject::get_isEncrypted() {}
#endif
AtlasObjectFactory.cpp:
#ifndef ATLASOBJECTFACTORY_CPP
#define ATLASOBJECTFACTORY_CPP
#include "AtlasObject.cpp"
class AtlasObjectFactory
{
public:
static void getInstance();
~AtlasObjectFactory();
AtlasObject* createObject(int obj_type);
private:
AtlasObjectFactory();
};
#endif
ATP.cpp:
#ifndef ATP_CPP
#define ATP_CPP
#include <string>
#include <map>
#include "AtlasObject.cpp"
using namespace std;
struct Image{
string Dim;
string Vox;
string Ori;
char* data;
};
class APT
{
private:
map<string,int> listOfMaps;
Image referenceImage;
protected:
};
#endif // AtlasObject.cpp
MAP.cpp:
#ifndef MAP_CPP
#define MAP_CPP
#include "AtlasObject.cpp"
class MAP : public AtlasObject
{
public:
void create();
};
void MAP::create()
{
}
#endif
Upvotes: 0
Views: 68
Reputation: 96810
In your AtlasObject.cpp file, you should add this:
using std::string;
Since std::string
is created under the namespace std
and you have no using namespace std
specified.
Upvotes: 3