編譯器錯誤 C2491
'identifier': 不允許定義 dllimport 函式
資料、靜態資料成員和函式可以宣告為 dllimport
,但不可定義為 dllimport
。
若要修正這個問題,請從函式定義移除 __declspec(dllimport)
規範。
下列範例會產生 C2491:
// C2491.cpp
// compile with: /c
// function definition
void __declspec(dllimport) funcB() {} // C2491
// function declaration
void __declspec(dllimport) funcB(); // OK