未指定字符串
String not specified
我正在尝试创建一个包含一堆不同类的程序。 不知何故,尽管#include < string>
已被多次使用,但我仍然遇到缺少类型说明符的错误。
我不知道在哪里。 有谁知道这个问题可能起源于哪里,或者如果没有,我可以采取任何步骤来尝试调试这个问题?
我很抱歉这个长帖子,我只是不想遗漏任何东西。
主.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
在你的 AtlasObject.cpp 文件中,你应该添加这个:
using std::string;
由于std::string
是在命名空间std
下创建的,因此您没有指定using namespace std
。
相关文章:
- 从 XML 中读取未指定结构的每个数据成员
- 用数据填充未指定大小的数组
- 访问从联合与另一个成员集复制的联合中的一个成员是否未定义或未指定?
- 双循环变量的相等条件:未指定还是未定义
- SQL Server-未找到数据源名称,也未指定默认驱动程序
- 无法创建长度未指定
- 在 txt 文件中搜索中间子字符串未被选中的字符串
- C++ 复制字符串的指定索引之间的任何子字符串
- C++ 检查 UTF8 字符串包含指定的字符
- 在Visual Studio中更新Qt翻译(.ts文件)时出现未指定错误
- 查找可变参数列表的字符串格式指定符
- 是否未指定在未评估的上下文中实例化模板/lambda
- 未定义与未指定与实现定义的行为
- 在 c++ 中获取未指定数量的输入
- 在尝试提交作业警告时,我一直在警告:与未指定行为的字符串字面结果比较[-WADDRESS]
- 与字符串文本进行比较会导致未指定的行为
- 字符串运算符的求值顺序未指定
- C++:警告:与字符串文本进行比较会导致未指定的行为 [-Waddress]
- 未指定字符串
- 字符串字面值的比较会导致未指定的行为- c++