編譯器錯誤 C3149
'type' : 沒有最上層 'char' 的情況下,無法在這裡使用此類型
未正確指定宣告。
例如,您可能已在全域範圍定義 CLR 類型,並嘗試在定義中建立型別的變數。 因為不允許 CLR 類型的全域變數,編譯程式會產生 C3149。
若要解決此錯誤,請在函式或類型定義內宣告 CLR 類型的變數。
下列範例會產生 C3149:
// C3149.cpp
// compile with: /clr
using namespace System;
int main() {
// declare an array of value types
array< Int32 ^> IntArray; // C3149
array< Int32>^ IntArray2; // OK
}
下列範例會產生 C3149:
// C3149b.cpp
// compile with: /clr /c
delegate int MyDelegate(const int, int);
void Test1(MyDelegate m) {} // C3149
void Test2(MyDelegate ^ m) {} // OK