草庐IT

expection

全部标签

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

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

c++ - C++ 中的 "error: Expected a type, got ' 类名 '"

使用以下代码:templateclassnode{[...]};classb_graph{friendistream&operator>>(istream&in,b_graph&ingraph);friendostream&operatorvertices;//Thisline我得到:error:type/valuemismatchatargument1intemplateparameterlistfor‘templateclassstd::vector’error:expectedatype,got'node'error:templateargument2isinvalid在指示的行

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++ - "Expected unqualified-id before ' 命名空间 '"错误

我有以下看似无害的代码:#ifndefUI_H#defineUI_H#includenamespaceui{//Displaysthemainmenu,showingloadedvocabularycards////ReturnsuponcompletionofdisplayvoiddisplayMainMenu();//...Morecodeliketheabove,justcommentsfollowedbyfunctions}#endif这给了我这个错误信息:filepath/ui.h:6:error:expectedunqualified-idbefore'namespace'

C++ - 错误 : expected unqualified-id before ‘using’

我有一个C++程序,当我尝试编译它时出现错误:calor.h|6|error:expectedunqualified-idbefore‘using’|这是calor类的头文件:#ifndef_CALOR_#define_CALOR_#include"gradiente.h"usingnamespacestd;classCalor:publicGradiente{public:Calor();Calor(inta);~Calor();intgetTemp();intgetMinTemp();voidsetTemp(inta);voidsetMinTemp(inta);voidmostra

c++ - 错误 : expected unqualified-id before 'if'

我用谷歌搜索了这个错误,直到脸色发青,但无法将任何结果与我的代码相关联。这个错误似乎通常是由错位或缺少大括号、parent等引起的。自从我编写任何C++以来也已经很长时间了,所以我可能遗漏了一些明显的、愚蠢的事情。这是我在QtCreator2.4.0中编写的QtMobile应用程序,基于Qt4.7.4(64位)构建于2011年12月20日11:14:33。#include#include#include#include#includeQFilefile("words.txt");QStringListwords;if(file.open(QIODevice::ReadOnly)){QT

android - 类型不匹配 : inferred type is String but Charset was expected in kotlin

我的主要Activity中有以下代码:varqNa_list=parseQuestions(loadJSONFromAsset("qna_list.json"))funloadJSONFromAsset(file_name:String):String?{varjson:String?=nulltry{valisis=assets.open(file_name)valsize=isis.available()valbuffer=ByteArray(size)isis.read(buffer)isis.close()json=String(buffer,"UTF-8")}catch(ex

android - 类型不匹配 : inferred type is String but Charset was expected in kotlin

我的主要Activity中有以下代码:varqNa_list=parseQuestions(loadJSONFromAsset("qna_list.json"))funloadJSONFromAsset(file_name:String):String?{varjson:String?=nulltry{valisis=assets.open(file_name)valsize=isis.available()valbuffer=ByteArray(size)isis.read(buffer)isis.close()json=String(buffer,"UTF-8")}catch(ex

c++ - GTest 和 GoogleMock EXPECT_CALL 在 Windows 中失败,在 Mac 上通过 char * param

我在我继承的一个项目中有一个看起来与此类似的测试std::stringvalue("teststring");constchar*buffer=value.c_str();EXPECT_CALL(object,foo(_,_,buffer,buffer.size(),_)).WillOnce(Return(0));bar(value);缓冲区是一个char*指向一串数据。我插入了像对象这样的虚拟值,只是为了关注似乎在使用EXPECT_CALL时出现的问题。在此EXPECT_CALL之后,调用方法bar将原始字符串值作为参数,然后在该方法中使用从原始字符串值构建的缓冲区调用foo。此测试

android - 混淆器错误 : Expecting class path seperator - not sure where I need to put a path in quotes

错误:BUILDFAILEDC:\workspace\projectName\add-proguard-release.xml:35:Expectingclasspathseparator';'before'Files\eclipse\android-sdk-windows\platforms\android-3\android.jar'inargumentnumber1我完全知道我的问题是我在c:\programfiles\eclipse目录中有eclipse+android-而“程序”和"file"之间的空格导致了这个问题。我也知道一个解决方案是将此路径放在引号中。我的问题是将这些