jjzjj

Identifier

全部标签

c++ - 有一个与命名空间同名的变量是否正确

这样做是否正确?:namespacename{intname;}voidproc(intname){name::name=name;}intmain(){intname=name::name;return0;}它适用于GCC。但这对于标准编译器和其他编译器是否可行? 最佳答案 是的,没关系,我们需要看看作用域解析运算符在这种情况下是如何工作的。如果我们看一下draftC++standard3.4.3Qualifiednamelookup实际上有一个非常相似的例子,它说(强调我的):Ifa::scoperesolutionoperat

c++ - CA2W 给了我一个 "' AtlThrowLastWin3 2': identifier not found"错误

当我遵循MSDNdocument时,我遇到了一个奇怪的编译错误在VisualStudio2005中使用CA2W将big5字符串转换为unicode字符串。这是我写的代码:#include#include#includeusingnamespacestd;int_tmain(intargc,_TCHAR*argv[]){stringchineseInBig5="\xA4\xA4\xA4\xE5";ATL::CA2W(chineseInBig5.c_str());return0;}编译错误:errorC3861:'AtlThrowLastWin32':identifiernotfound我

c++ - 什么是 sa_family_t

我正在关注Beej'sGuidetoNetworkProgramming,并且我使用的是VC++2010,但是当我将结构复制粘贴到我的程序中时,某些类型会作为不正确的标识符出现。例如:u_int32_t就是这样出现的,经过一些搜索我发现这些是C语言大约1999年的旧类型。我本可以包含stdint.h,但这需要我记住它们的意思。相反,我使用了标准的int,它是32位长(4字节),而对于其他的64位长(8字节),我使用了longlongint.无论如何,我正在缩小我的最后一个语法错误,它说sa_family_t是一个无效的标识符。我不知道它应该是什么,搜索也没有任何结果。那是我的问题,我不

【Flink】ValidationException: Could not find any factory for identifier ‘jdbc‘ that implements ‘org.ap

在我们使用FlinkSQL客户端执行sql的时候,报下图错误:FlinkSQL>CREATETABLEtest_input(>   idSTRINGprimarykey,>   nameSTRING,>   typeSTRING>)WITH(> 'connector'='jdbc',> 'url'='jdbc:mysql://localhost:3306/cdc',> 'username'='root',> 'password'='root',> 'table-name'='cdc_test'>);[INFO]Executestatementsucceed.FlinkSQL>select*fr

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++ - Boost 1.55 不适用于 Visual Studio 2013

我已经正确编译了boost二进制文件并按照所有说明进行操作,但是我遇到了很多错误,我不知道为什么!这是我的“包含”设置:这是我用来测试boost的代码:#include//includeboost#includeusingnamespacestd;usingnamespaceboost::asio;//savetonsoftyping//Thesearethevaluesourportneedstoconnect#ifdef_WIN32//windowsusescomports,thisdependsonwhatcomportyourcableispluggedinto.constch

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++ - 标识符字符集 (clang)

我从不使用clang。而且无意中发现了这段代码:#includevoidфункция(intпеременная){std::cout将编译正常:http://rextester.com/NFXBL38644(clang3.4(clang++-Wall-std=c++11-O2)).它是clang扩展吗??为什么?谢谢。UPD:我想问的是为什么clang会做出这样的决定?因为我从来没有发现有人想要比c++标准现在更多的字符的讨论(2.3,修订版3691) 最佳答案 与其说它是一个扩展,不如说它是Clang对标准的多字节字符部分的解