Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2144

syntax error : 'type' should be preceded by 'token'

The compiler expected token and found type instead.

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

C2144 can also occur when attempting to create a macro from a CLR keyword that contains a white space character.

You may also see C2144 if you are trying to do type forwarding. See Type Forwarding for more information.

The following sample generates C2144.

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

// OK
#define REF1 ref struct
REF1 MyStruct1;

The following sample generates C2144.

// C2144_2.cpp
// 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) {}
   }
};

Community Additions

ADD
Show:
© 2015 Microsoft