RSS
Follow Us
Contribute
 
 
 
 

Error C2144: syntax error : (type) should be preceded by (token)

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution
  3. 3. (ToDo)
  4. 4. About This Article

Cause

The compiler expected token and found type instead.

This error may be caused by a missing closing brace, right parenthesis, or semicolon.

This error can also occur when attempting to create a macro from a CLR keyword that contains a white space character. Ex:

// compile with: /clr /c
#define REF ref
REF struct MyStruct0;   // C2144

// OK
#define REF1 ref struct
REF1 MyStruct1;

Ex:

// compile with: /clr /c
ref struct X {

   property double MultiDimProp[,,] {   // C2144
   // try the following line instead
   // property double MultiDimProp[int , int, int] {
      double get(int, int, int) { return 1; }
      void set(int i, int j, int k, double l) {}
   }

   property double MultiDimProp2[] {   // C2144
   // try the following line instead
   // property double MultiDimProp2[int] {
      double get(int) { return 1; }
      void set(int i, double l) {}
   }

Solution

(ToDo)

Write the solution section to improve the article.

About This Article

This article is a derivative work based on Compiler Error C2144 which is provided by MSDN Community Content - Visual C++.

 
 
 
 
Comments