草庐IT

identifier-case-sensitivity

全部标签

c++ - 错误 C2196 : case value '?' already used

好的,在代码中使用VisualStudioUltimate2012构建时出现奇怪的错误(可能是ANSI、unicode等问题)...switch(input[index]){case'א'://AlefHebrewcharacterif(/*conditional*/){//Dostuff.}break;case'ב'://BethHebrewcharacterif(/*conditional*/){//Dostuff}break;default:{//Dosomeotherstuff.}break;}第二个case参数生成...ErrorC2196:casevalue'?'alrea

c++ - 为什么我得到 "error C2006: ' #include' : expected a filename, found 'identifier' "?

我在VisualC++Express2008中的源代码如下:#include“stdafx.h”#includeint_tmain(intargc,_TCHAR*argv[]){std::cout我正在使用IvorHorton的书VisualC++2008。这些是我遇到的错误。如何消除这些错误?1>e:\mydocuments\visualstudio2008\projects\hello\hello\hello.cpp(1):errorC2006:'#include':expectedafilename,found'identifier'1>e:\mydocuments\visual

c++ - 在 C 枚举错误中使用单词 "SING"到 "expected an identifier"

在头文件中我有以下枚举:namespaceOBJ_VERBS{enum{zero,CUDDLE,EMBRACE,FLIP,GROPE,HUG,KISS,LICK,NUDGE,PAT,PINCH,POKE,PULL,RUB,SHAKE,SQUEEZE,TAP,TUG,TURN,WAVE,PEER,PET,CLENCH,CURSE,NUZZLE,SNAP,STROKE,TWIRL,LEAN,GRIP,SMELL,GRUNT,SQUEAL,SCOLD,GAZE,WIND,SPIT,SPIN,DANCE,SING,zTOTAL};constint_MAX_=int(OBJ_VERBS::zTO

c++ - 写 "::namespace::identifier"和 "namespace::identifier"有什么区别?

我在代码中看到了这两种方法。你能解释一下这两者有什么区别吗?正如我认为它与C++完成命名空间查找的方式有关,您能否也提供一些相关信息,或者提供一个好的文档的链接?谢谢。 最佳答案 示例:#includenamespacex{constinti=1;}namespacey{namespacex{constinti=2;}voidfunc(){std::printf("x::i=%d\n",x::i);std::printf("::x::i=%d\n",::x::i);}}intmain(){y::func();return0;}输出:

c++ - 继续获取 "error: use of undeclared identifier ' cout' 和错误 : reference to overloaded function could not be resolved

我正在编写一个使用许多不同函数的排序程序,你们都可以从我的声明。但是,当我尝试编译和运行我的程序时,我不断遇到这些相同的错误它们如下:error:useofundeclaredidentifier'cout';didyoumean'count'?couterror:referencetooverloadedfunctioncouldnotberesolved;didyoumeantocallit?couterror:useofundeclaredidentifier'endl';didyoumean'end'?cout我不太确定为什么会出现这些错误....我想我已经包含了我需要的一切为

我不明白的 C++ 错误 : syntax missing ';' before identifier

classDialogue{public:intid;inttrigger;Questiondescendants[5];//Maxquestionsperdialoguestringtext;};classQuestion{public:intid;intdescendant;intancestor;stringtext;};当我尝试构建它时,它说问题后代位出现以下错误?Error1errorC2146:syntaxerror:missing';'beforeidentifier'descendants'c:\users**\documents\visualstudio2012\pr

c++ - 错误 C3861 : '_tcsdup' : identifier not found

这是我第一次,我想使用Windows进行并行处理CreateProcess功能。基于MSDN上的示例,我创建了一个LPTSTR"(non-const)TCHARstring"commandline这样的争论LPTSTRszCmdline[]=_tcsdup(TEXT("\C:\\MyProgram_linux_1.1\\MyProgram.exe"));LPTSTR和其他charandstringtypesarediscussedhere命令行参数传递给CreateProcess像这样if(!CreateProcess(NULL,szCmdline,/*...*/))cout并且存在这

c++ - 使用 std::string 在 switch-case block 中返回字符串常量

注意:这不是关于使用字符串来选择switch-caseblock中的执行路径。C++中的一个常见模式是使用switch-caseblock将整数常量转换为字符串。这看起来像:charconst*to_string(codescode){switch(code){casecodes::foo:return"foo";casecodes::bar:return"bar";}}但是,我们是在C++中,所以使用std::string更合适:std::stringto_string(codescode){switch(code){casecodes::foo:return"foo";caseco

c++ - 为什么某些 IDE 不缩进 switch 中的 case 语句?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Whydon'tpeopleindentC++accessspecifiers/casestatements?我有一个语法问题...不是关于如何,而是关于为什么。许多IDE,例如Eclipse和QtCreator会自动缩进一个switch,如下所示:DayrandomDay=getRandomDay();/*returns'enumDay'*/switch(randomDay){default:caseMonday:/*...*/break;caseTuesday:/*...*/break;/*...*/}我

c++ - 在 switch 语句中使用 vector 时出现 "Jump to case label"错误。

这个问题在这里已经有了答案:Whycan'tvariablesbedeclaredinaswitchstatement?(23个回答)关闭9年前。这是代码,当我添加其他大小写或默认值时,会出现几个错误。我找不到任何基本错误,例如缺少分号等,并且当我只有一种情况时,代码可以正常工作。我搜索了switch教程,但我没有发现任何关于vector和switch语句混合的问题。intmain(){intr;while(cin>>r){switch(r){case3:inty=0;coutnums;intx;while(cin>>x){nums.push_back(x);y++;}sort(num