草庐IT

METHOD_NAME

全部标签

c++ - VS2008 : Can I build a project with 2 CPP files of the same name in different folders?

这是我的文件夹结构:/|--program.cpp--utility.h--utility.cpp|--module/|--utility.h--utility.cpp//NotethatIhavetwofilesnamedutility.handtwonamedutility.cpp在构建项目时,我收到链接错误(LNK2028:未解析的token等...),指出某些符号未定义。我已经确认所有符号都已定义,并且所有声明的函数都有相应的定义。我有一种感觉,在编译我的项目时,两个文件夹中的utility.cpp文件被编译到输出文件夹中的相同utility.obj中。结果,一个覆盖了另一个。

c++ - 如何从 HWND 获取 Window Class Name 和 Id?

如何从HWND获取窗口类名和Id?我搜索了一下,发现相反的更受欢迎。有什么想法吗?!?!? 最佳答案 Andreas的回答和Arthur显示如何获取类名。对于“Id”,您可能指的是子窗口的窗口标识符;GetWindowLong(HWnd,GWL_ID) 关于c++-如何从HWND获取WindowClassName和Id?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/324666

C++: "error: expected class-name before ‘{’ token"继承模板类时

我四处寻找问题的解决方案,发现了很多关于循环引用和namespace的问题(均不适用于我的情况),但与我遇到的问题完全不同。我在maths/matrix.h中定义并实现了一个模板类:templateclassMatrix{public://constructors,destructorsandwhatnot...};我在maths/vector.h中定义并实现了另一个模板类#includetemplateclassVector:publicMatrix{public://constructors,destructorsandwhatnot...};我在vector.h中收到此错误“ex

c++ - 如何修复错误 : unknown type name ‘namespace’

#ifndefUNO_ACTION_#defineUNO_ACTION_namespaceUno{namespaceGame{classGame;}}//namespacenamespaceUno{namespaceAction{using::Uno::Game::Game;classAction{public:virtualboolisDisposeable()=0;virtualvoidtakeAction(Game*game)=0;virtual~Action(){}};}}#endif我在ubuntu12.04上编译这些代码,它返回错误集:action.h:4:1:error:

c++ - 这个模式 : using a struct to contain a single method 有什么意义

在我们的代码中,我们有很多这种模式的情况:classouterClass{structinnerStruct{wstringoperator()(wstringvalue){//dosomethingreturnvalue;}};voiddoThing(){wstringinitialValue;wstringfinalValue=innerStruct()(initialValue);}};这样做的好处是什么:classouterClass{wstringchangeString(wstringvalue){//dosomethingreturnvalue;}voiddoThing(

c++ - 尝试包装函数返回值时出现 "<class name> does not provide a call operator"错误

我正在尝试编写一个函数,它将一个仿函数作为参数,调用仿函数,然后返回它的返回值,并将其包装在boost::shared_ptr中。以下拒绝编译,我完全没有想法。我得到“std::vector不提供调用操作符”(大致)。我在MacOSX上使用Clang3.1。templateboost::shared_ptrReturnValueAsShared(boost::functionfunc){returnboost::make_shared(func());}这是我尝试使用它的上下文:make_shared>>>(bind(ReturnValueAsShared>,bind([afuncti

c++ - 如何对重载运算符使用 gmock MOCK_METHOD?

我是googlemock(和StackOverflow)的新手。我在googlemock中使用MOCK_METHODn时遇到问题,我相信这个函数被广泛使用。这是我所做的。我有一个抽象类Foo,带有虚拟重载的operator[]:classFoo{public:virtual~Foo(){};virtualintoperator[](intindex)=0;}我想使用googlemock来获取MockFoo:classMockFoo:publicFoo{public:MOCK_METHOD1(operator[],int(intindex));//Thecompilerindicates

c++ - Type** name 和 Type* name[] 有什么区别?

Type**name和Type*name[]有什么区别?为什么有人会使用一个而不是另一个?谢谢 最佳答案 这取决于它是在变量声明中还是在函数参数中?如果在变量声明中:Type**name=&pointer_to_type;Type*name[]={&pointer_to_type,0,&pointer_to_type};第一个是指向类型的指针,而第二个是指向长度为3的类型的指针数组。如果在函数参数中,它们是一样的。数组衰减为指针,Type**name和Type*name[]与函数参数完全相同。但是,第二种形式清楚地表明name是一个

c++ - 错误 : c++ [map] does not name a type

我编写了以下内容作为文本冒险游戏的文本命令解析器的一部分。我试图将用户输入的字符串与枚举类中的项目相关联。以下是我的头文件:#include#include#includeusingnamespacestd;enumclassNoun{//Interrogationsubjectsname,//askthesubjecthisnamebase,//whereisthebase?attack,//whenwilltheattackbe?invalid};mapknownNouns;knownNouns["name"]=Noun::name;knownNouns["base"]=Noun:

class - Class< 的语法是什么?在 kotlin 中扩展 class_name>?

我正在尝试创建一个接受从Word_Class继承的任何类变量但它不起作用的Arraylist:varlst=ArrayList>();lst.add(Class);我正在寻找Class 最佳答案 您可以使用outtypeprojection在Kotlin。它相当于?扩展Java中的T,例如://v---outtypeprojectionvarlst=ArrayList>()要获得一个Java类你应该使用KClass#java,例如://v---getaKClassinstancelst.add(Noun_Class::class.j