Unexpected interface name 'RCTBridge': expected expression
enter image description here
Related
I tried using auto instructor = instructors[_address] it gives me the error:
DeclarationError: Identifier not found or not unique.
You can define the variable first with their type and then assign them to their respective value. In your case it is:
Instructor storage instructor = instructors[_address]
I'm struggling with what seems to be a bug in Visual Basic. I'm probably missing something. Hopefully someone can point out what it is.
Section 7.5 of the Visual Basic Specification for version 10.0 says that this is the grammar for class declaration. Forgive the lack of italics that indicates the difference between literals and grammar nodes.
ClassDeclaration ::=
[ Attributes ] [ ClassModifier+ ] Class Identifier [ TypeParameterList ] StatementTerminator
[ ClassBase ]
[ TypeImplementsClause+ ]
[ ClassMemberDeclaration+ ]
End Class StatementTerminator
ClassModifier ::= TypeModifier | MustInherit | NotInheritable | Partial
So the minimal class declaration would be
Class Identifier StatementTerminator
End Class StatementTerminator
The grammar for Identifier and some other supporting nodes are specified in 13.1.2,
Identifier ::=
NonEscapedIdentifier [ TypeCharacter ] |
Keyword TypeCharacter |
EscapedIdentifier
NonEscapedIdentifier ::= < IdentifierName but not Keyword >
TypeCharacter ::=
IntegerTypeCharacter |
LongTypeCharacter |
DecimalTypeCharacter |
SingleTypeCharacter |
DoubleTypeCharacter |
StringTypeCharacter
IntegerTypeCharacter ::= %
LongTypeCharacter ::= &
DecimalTypeCharacter ::= #
SingleTypeCharacter ::= !
DoubleTypeCharacter ::= #
StringTypeCharacter ::= $
Based on my reading of this foo! should be a legal identifier because ! is a TypeCharacter.
So, based on the minimal legal class declaration above, this should be legal.
Class foo!
End Class
But Visual Studio 2010 gives this:
Type declaration characters are not valid in this context.
Am I missing something in the spec, or does the compiler disagree with the spec?
The grammar doesn’t stand on its own, the describing text is part of the specification. This is important here, because otherwise you’d be right. But as competent_tech has noted in his answer, the TypeCharacter production, while forming part of the Identifier production, is not a valid character in an identifier – except to denote a variable’s (or function’s) type.
This is specified in 2.2.1:
A type character denotes the type of the preceding identifier. The type character is not considered part of the identifier. If a declaration includes a type character, the type character must agree with the type specified in the declaration itself; otherwise, a compile-time error occurs.
Appending a type character to an identifier that conceptually does not have a type (for example, a namespace name) or to an identifier whose type disagrees with the type of the type character causes a compile-time error.
(Emphasis mine.)
The section even gives an explicit example of an invalid use that is equivalent to your use. So the specification explicitly forbids this.
The TypeIdentifier is used to declare the data type of a property, variable, function, etc.
Public Class Foo
Dim x!
' The above declaration is the same as
'Dim x As Single
End Class
Since there is no data type for a class, adding a type identifier does not make any sense. Based on this, it seems like the spec may not be entirely correct.
OK, after migrated to Gecko 2.0 for my XPCOM Component,
I fixed a couple of thg like below:
1. Replacing #include "nsIGenericFactory.h" to #include "mozilla/ModuleUtils.h"
2. Replacing xpcomglue_s.lib to xpcomglue_s_nomozalloc.lib
3. Adding #include "mozilla-config.h" to xpcom-config.h header file
4. And as well as remove a couple of unused header file eg: nsReadableUtils.h, nsEventQueueUtils.h, nsIExtensionManager.h
5. Replacing NS_DEFINE_STATIC_IID_ACCESSOR(IMYPROGRAM_IID) to NS_DEFINE_STATIC_IID_ACCESSOR(IMyProgram, IMYPROGRAM_IID)
Reduced from 200+ errors to 20+ now, below are a few more errors which i have no idea what is that, any expert here encounter problem like below?
error C3254: 'IMyProgram' : class contains explicit override 'kIID' but does not derive from an interface that contains the function declaration
error C2838: 'kIID' : illegal qualified name in member declaration
error C3857: 'IMyProgram::kIID': multiple template parameter lists are not allowed
error C2084: function 'void nsTraceRefcnt::LogAddRef(void *,nsrefcnt,const char *,PRUint32)' already has a body
error C2084: function 'void nsTraceRefcnt::LogRelease(void *,nsrefcnt,const char *)' already has a body
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '*'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '*'
error C2146: syntax error : missing ';' before identifier 'components'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2440: 'initializing' : cannot convert from 'const char [13]' to 'int'
error C2078: too many initializers
error C2448: 'NS_IMPL_NSGETMODULE' : function-style initializer appears to be a function definition
error C2143: syntax error : missing ';' before '__stdcall'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '*'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2556: 'int MyProgramRegistration(nsIComponentManager *,nsIFile *,const char *,const char *,const int)' : overloaded function differs only by return type from 'nsresult MyProgramRegistration(nsIComponentManager *,nsIFile *,const char *,const char *,const int)'
error C2371: 'MyProgramRegistration' : redefinition; different basic types
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '*'
error C3254: 'IMyProgram' : class contains explicit override 'kIID' but does not derive from an interface that contains the function declaration
error C2838: 'kIID' : illegal qualified name in member declaration
error C3857: 'IMyProgram::kIID': multiple template parameter lists are not allowed
At the very least it looks as if you are missing an NS_DECLARE_STATIC_IID_ACCESSOR(IMYPROGRAM_IID) in your interface (xpidl would have generated that for you automatically.) Some of the other errors are a bit harder to figure out without source code, but the chances are that you haven't quite managed to update your module registration code correctly.
We received this piece of code for an assignment, and after spending a lot of time fixing the problems within, I ended up with a syntax error : identifier 'String'. Everywhere I look on the web, people are using std::string, but this is not what the code is referring to since the function is called from a C# project using a String object.
Here is the declaration :
int findWindow(String ^CaptionText,IntPtr ^%phWnd,
int %left,int %top,int %right,int %bottom);
And I have no idea how to fix that one. There are other errors such as
error C2062: type 'int' unexpected
...
error C2065: 'IntPtr' : undeclared identifier
error C2065: 'String' : undeclared identifier
...
etc.
Any help appreciated.
Should I mention that those errors have nothing to do with the assignment?
use System::String and System::IntPtr or write using namespace System;
This error message had me stumped for a while:
invalid conversion from 'objc_object* to 'int'
The line in question was something like this:
int iResult = [MyUtils utilsMemberFunc:param1,param2];
It doesn't matter what the "to" type is, what is important is that you recognize that this message, in this context, is reporting that the utilsMemberFunc declaration was not found and due to Objective-C's dynamic binding it is assuming it returns an objc_object* rather than the type that utilsMemberFunc was declared to return.
So why isn't it finding the declaration? Because ',' is being used rather than ':' to separate the parameters.