jjzjj

Redefinition

全部标签

c++ - 为什么一个非常量静态成员会有多个定义?

C++强制程序员在类外定义一个非常量静态成员,我一直看到的原因是如果静态成员是在类内定义的,这将导致静态成员的多个定义。我明白有静态成员的多个定义是不好的,但我不明白这些多个定义在哪里定义甚至会来自。不应该是一个初始化的非常量静态成员只是进入数据部分,这是唯一的定义?structStudent{staticintx=4;//Whywouldthisresultinmultipledefinitions?};此外,我在另一篇stackoverflow帖子中读到,conststatic成员在使用它的任何地方都被简单地内联到代码中:Whycan'tIhaveanon-integralstat

c++ - VS2010 中的 "redefinition; different type modifier"

我正在尝试编译我在visualstudio中下载的一些代码。该代码适用于msvc6,我将其导入VS2010。该代码用于通过编译一个DLL来为labview提供ASIO支持。见here对于整个代码。构建时出现以下错误:“错误C2373:‘_pctype’:重新定义;不同的类型修饰符。”代码片段如下:unsignedshort_Ints[512];unsignedshort*_pctype=_Ints;如果有人要从我提供的链接中引用代码包,这是来自文件GenMonCIN.c 最佳答案 错误消息试图告诉您_pctype已在其他地方定义。它

c++ - 多重包含错误,找不到解决方案

我最近一直在为多个文件包含错误而苦恼。我正在开发一款太空街机游戏,并将我的类/对象分成不同的.cpp文件并确保一切正常,我构建了以下头文件:#ifndefSPACEGAME_H_INCLUDED#defineSPACEGAME_H_INCLUDED//SomeMainconstants#definePI3.14159265//Standardincludes#include#include#include#include#include#include#includeusingnamespacestd;//SDLheaders#include"SDL.h"#include"SDL_op

c++ - 错误 C2375 : redefinition; different linkage

api中错误的地方:#defineDLLEXPORTextern"C"__declspec(dllexport)DLLEXPORTintCAnyseeUSBTVControllerDlg::InitCaptureDevice(){在我的.h库类和函数定义中:classCAnyseeUSBTVControllerDlg:publicCDialog{//Constructionpublic:intInitCaptureDevice(void);知道如何解决吗?"Error1errorC2375:'CAnyseeUSBTVControllerDlg::InitCaptureDevice':r

c++ - 错误 : redefinition of class

这是我的代码://inmain.cpp#include"iostream"#include"circle.cpp"#include"rectangle.cpp"#include"shape.cpp"usingnamespacestd;intmain(){Shapeshapes[10];for(inti=0;iwidth=width;}virtualvoidsetHeigth(intheight){this->height=height;}};//inshape.cppclassShape{public:virtualintgetArea()const=0;};编译时,我得到这个错误:e

C++ 函数的错误信息重定义

我正在使用两个堆栈来实现一个队列类。我的头文件如下所示:#ifndef_MyQueue_h#define_MyQueue_husingnamespacestd;templateclassMyQueue{public:MyQueue();~MyQueue();voidenqueue(Telement);Tpeek();voiddequeue();intsize();boolempty();private:intcount;stackstk1;stackstk2;};#include"MyQueue.cpp"#endif我的cpp(实现)文件如下所示:#include#include"My

ios - 为模拟器构建时为 "Redefinition of module ..."

我有一个iOSxcode项目,当我选择GenericiOSDevice作为我的目的地时,它构建得很好。但是,当我选择任何模拟器选项时,我的构建失败并出现许多Redefinitionofmodule'abcde',对于iOS11.4/usr/include/module.modulemap中定义的每个模块都有一个错误。重复的定义来自Simulator-iOS11.4/usr/include/module.modulemap。我梳理了我的工作区/项目设置,没有发现对模拟器的引用。所有部署目标都是iOS11.4。看来,当我为模拟器构建时,它同时包括平台和模拟器模块。如何指定其中之一?添加co

c++ - "Class type redefinition"头文件和源文件之间的错误

所以我遇到了一个问题,我确信有一个非常明显的解决方案,但我似乎无法弄清楚。基本上,当我尝试在我的头文件中进行类定义并在我的源文件中进行实现时,我收到一条错误消息,提示我正在重新定义我的类。使用VisualC++2010Express。确切错误:“错误C2011:‘节点’:‘类’类型重新定义”示例代码如下:节点.h:#ifndefNODE_H#defineNODE_H#includeclassNode{public:Node();Node*getLC();Node*getRC();private:Node*leftChild;Node*rightChild;};#endif节点.cpp:

c++ - 单个类出现类重定义错误

我是C++新手,头文件中的类定义有问题。头文件(Student.h)的代码是:#includeusingnamespacestd;classStudent{//DataMembersforaStudentstringid;stringpreferences[3];intskill;//Constructorpublic:Student(){}public:voidSetID(stringstr){this->id=str;}public:voidSetSkill(inti){this->skill=i;}public:voidSetPreferences(inti,strings){t

c - c中的重定义错误

我必须包含“windows.h”。问题是重新定义,在windows.h中:_gdi_entryWINGDIAPIBOOLWINAPIPolygon(__inHDChdc,__in_ecount(cpt)CONSTPOINT*apt,__inintcpt);我的部分代码是(来自其他包含):typedefstructPolygon{U8numElements;PolygonPointselement[15];}Polygon;我无法更改代码中的定义。我为ShellExecute()包含了windows.h。试图取消定义:#ifdefPolygon#undefPolygon#endif没有帮