编译器错误 C3618
“function”: 标记为 DllImport 的方法无法定义
使用 DllImportAttribute 标记的方法在 specified.DLL 中定义。
示例
下面的示例生成 C3618。
// C3618.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;
[ DllImport("user32.dll", EntryPoint="MessageBox", CharSet=CharSet::Ansi) ] // CHANGED
void Func();
void Func() {} // C3618, remove this function definition to resolve