草庐IT

Specifier

全部标签

c++ - 在另一个类的构造函数的成员初始化程序中声明的类在它之外是否可见?

考虑以下代码:structFoo{void*p;Foo():p{(classBar*)0}{}};Bar*bar;最新版本的GCC(8.2)和Clang(7.0.0)编译失败。ICC(19.0.1)也是如此。但是MSVC(v19.16)可以干净地编译它。来自GCC的错误是:error:'Bar'doesnotnameatype;你是说'char'吗?Clang和ICC发出类似的消息。allfourcompilersatgodbolt的一致性查看器.那么根据标准,哪个编译器是正确的? 最佳答案 [basic.lookup.elab].

c++ - 错误 : incomplete type used in nested name specifier

有2个非模板类A,B有一些静态模板方法。从类A调用B中的静态方法,并从类B调用A中的静态方法.源代码仅供说明(非真实代码)...啊.h#include"B.h"classA{public:templatevoidf1(){Tvar1=...;Tvar2=B::f4(T);}templateTf2(){return...}};#include"A.h"classB{public:templatevoidf3(){Tvar1=...;Tvar2=A::f2(T);//Error}templateTf4(){return...}};我在使用NetBeans中的g++编译器时遇到问题。在编译过

c++ - 错误 : incomplete type used in nested name specifier

有2个非模板类A,B有一些静态模板方法。从类A调用B中的静态方法,并从类B调用A中的静态方法.源代码仅供说明(非真实代码)...啊.h#include"B.h"classA{public:templatevoidf1(){Tvar1=...;Tvar2=B::f4(T);}templateTf2(){return...}};#include"A.h"classB{public:templatevoidf3(){Tvar1=...;Tvar2=A::f2(T);//Error}templateTf4(){return...}};我在使用NetBeans中的g++编译器时遇到问题。在编译过

C++ - 运算符重载错误 C4430 : missing type specifier - int assumed

我使用Borland5.5编译我的代码,没有弹出任何错误。但它无法正常运行,所以我决定使用VisualStudio2010来调试我的程序。VisualStudio给我这个错误:Error1errorC4430:missingtypespecifier-intassumed.Note:C++doesnotsupportdefault-intc:\users\johnny\documents\visualstudio2010\projects\stack_linkedlist\stack_linkedlist\classstack.cpp1111STACK_LinkedList它指向我的运

c++ - 警告 : 'auto' type specifier is a C++11 extension [-Wc++11-extensions]

我在DebianJessie上使用带有Clang的Qt5。要试验通用lambda,在.pro文件中有:CONFIG+=c++14在构建之后我得到了:warning:'auto'typespecifierisaC++11extension[-Wc++11-extensions]为了摆脱这个明显的信息,我做了:QMAKE_CXXFLAGS+=-Wc++11-extensions但我不断收到明显的信息。为什么?如何隐藏? 最佳答案 根据qmake的存储库历史记录,CONFIG+=c++14节在qmake5.4版中添加:https://co

c++ - 'static void' 作为 decl-specifier

以下代码可以用clang编译。我想知道C++标准是否适合这个。classA{staticvoidx;//#1staticconstvoidx;//#2staticvolatilevoidx;//#3};在我看来,所有的声明都是无效的。perenialC++standardvalidationsuite有这样一个这样的测试(#1)和clang(v3.4)失败了。不过,如果我从#1中删除静态,则clang会按预期报告错误。我查看了标准,发现了一段关于静态数据成员(9.4.2-2)的内容:2Thedeclarationofastaticdatamemberinitsclassdefinitio

ios - 在方法 block 中使用方法声明中的变量时出现 "variable is not assignable (missing __block type specifier)"错误

我正在开发一个从服务器检索信息的小型iOs应用程序,我发现NSURLSessionDataTask非常有用。首先,我使用了一个@property(nonatomic,strong)NSMutableArray*objectArray;我在我的方法中调用了它:-(void)createObjectsArrayFromUrl:(NSString*)url{NSURL*URL=[NSURLURLWithString:url];NSURLRequest*request=[NSURLRequestrequestWithURL:URL];NSURLSession*session=[NSURLSes

c++ - "expected nested-name-specifier before ‘const’ 错误“在 g++ 中类型名称为 const

我在C++中有这段代码templateclassDD:publicenumerables{...private:typenameconstDD&mContainer;}它给了我两条错误信息:错误:在“const”之前需要嵌套名称说明符错误:“&”标记前的声明符无效typenameconst有什么问题?代码?它使用MSVCC++编译得很好。已添加typenameDD&constmContainer;和consttypenameDD&mContainer;给我同样的错误。 最佳答案 那么,typename在那里做什么?您指的不是嵌套类型

iphone - 错误 : expected specifier-qualifier-list before 'cv'

我正在使用OpenCV框架进行图像处理,我正在识别照片中的边缘普通的iOS项目,现在我在cocos2d项目中转换这段代码,我已经导入了所有需要header,但在编译时出现此错误:“cv”之前的预期说明符限定符列表。这是我的代码#import"cocos2d.h"#import"CameraController.h"#import"Globals.h"@interfaceBotoxEffectController:CCLayer{cv::VideoCapture*_videoCapture;cv::Mat_lastFrame;}//thisislinewhereiamgettingerr

ios - "Missing __block type specifier"重构代码后编译错误但重构前正常

我有一些代码可以下载图像并将其分配到一个block中。该代码当前有效,但是我想将其重构为单独的方法,但是在重构后出现编译错误。这是在成功分配下载的图像的情况下编译和运行的原始代码:-(void)someMethod{…MyObject*object=[[MyObjectalloc]init];[self.objectsaddObject:object];NSString*graphRequest=[NSStringstringWithFormat:@"%@%@%@",@"https://graph.facebook.com/",fbid,@"/picture?type=square"]