弦装饰班导致许多构建错误
String decorator class leads to numerous build errors
我已经为std :: string创建了一个装饰器类,该类别(包括在项目中)会导致数千个构建错误源自cmath.h,cstring.h,xstring等文件。.H我无法弄清楚原因。需要字符串操作的项目中的所有文件都使用此类代替STD :: String以保持一致性。
我试图慢慢评论装饰班的某些部分,以试图理解实际发生的事情,但是一旦整个班级被评论出来,这些错误才开始有意义。在这里列出所有错误有太多错误,但是一小部分错误包括:
Error C2733 'abs': second C linkage of overloaded function not allowed
Error C2065 'allocator': undeclared identifier
Error C2974 'std::basic_string': invalid template argument for '_Alloc'
Error C2873 'strxfrm': symbol cannot be used in a using-declaration
Error C2535 'void std::basic_string<_Elem,_Traits,_Alloc>::_Construct(_Iter,_Iter)': member function already defined or declared
在多个标准库文件中有成千上万个错误。这是字符串装饰器的标题文件:
#pragma once
#include <string>
#include <vector>
namespace Framework
{
class String
{
private:
std::string Data;
public:
String();
String(const char*Init);
String(int Init);
friend String operator+(String &LHS, String &RHS);
friend String operator+(String &LHS, const char *RHS);
friend String operator+(String &LHS, const char RHS);
String& operator+=(String &RHS);
String& operator+=(const char *RHS);
String& operator+=(const char RHS);
friend bool operator==(String &LHS, String &RHS);
friend bool operator==(const String &LHS, const String &RHS);
friend bool operator==(String &LHS, const char *RHS);
friend bool operator==(const String &LHS, const char *RHS);
friend bool operator!=(String &LHS, String &RHS);
friend bool operator!=(const String &LHS, const String &RHS);
friend bool operator!=(String &LHS, const char *RHS);
String& operator=(const char * RHS);
char operator[](int Index);
size_t Length();
size_t IndexOf(String SubString, size_t Offset = 0);
bool Contains(String SubString, size_t Offset = 0);
String SubString(size_t Start, size_t Count = 0);
std::vector<String> Split(char Delimeter, bool KeepEmpty = false);
const char *ToCharString();
void Insert(int Position, String Text);
void RemoveAt(int Index);
int ToInt();
double ToDouble();
bool ToBoolean();
unsigned __int8 ToByte();
};
}
使这一更加困惑的是,该外墙在另一个项目中完美效果,这是在这个新项目中似乎失败的。
我不确定是什么原因造成了这个问题,但是它的分辨率是将字符串。在项目的根源上。一旦我做到了,然后将所有内容都恢复到使用Framework :: string的所有内容,该项目就可以了。
关于为什么工作的线索可能是一个事实,即如果我右键单击#include "String.h"
行时,string.h和string.cpp仍在root Directory中并选择打开文档,则打开标准库字符串。h文件而不是我的字符串.h文件。
相关文章:
- C++为构建时间获取QDateTime的可靠方法
- 无法在 CLion 中构建 C++ 项目
- 函数向量_指针有不同的原型,我可以构建一个吗
- 如何使用ndk-build.cmd构建Android.so文件
- libssh 的函数在构建 libssh 时无法在 Qt 和 cmake 错误中找到
- 使用cmake从源代码构建MySQL连接器/C++失败(与以前的声明冲突)
- VSCode-有一个红色下划线,但程序构建和运行正确,并且出现配音错误
- 在混合代码库中将C转换为C++时出现许多包含错误
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 无法使用Qt Creator在Windows中构建yaml-cpp
- 构建一个由C和C++文件组成的库
- llvm构建器向基本块添加终止符
- Qt <winInet.h> 在构建时输出许多 C4430 和 C2146 错误
- 在使用VS2010构建ACE和TAO(CORBA)时发生了许多错误
- 弦装饰班导致许多构建错误
- 当许多目标使用相同的C 源时,如何加快介子的构建
- 如果构建和破坏了许多向量,自定义分配器会提高性能<T>吗?
- 为什么必须在 Linux 系统上"installed" uuid.h 才能构建许多C++程序,而不仅仅是放入 include 或 lib 文件夹
- 静态Qt程序在VS2013中构建-许多未解决的外部
- 在 Eclipse 中使用 OpenCV 在项目中C++构建错误:对"SelectObject@8"的未定义引用 + 许多其他错误