编译器警告(等级 3)C4792
函数“function”使用 sysimport 声明并从本机代码引用;需要链接导入库
从非托管函数调用通过 DllImport 导入到程序中的本机函数。 因此,你必须链接到该 DLL 的导入库。
无法在代码中解决该警告,也无法通过改变编译方式来解决。 请使用 警告 杂注禁用此警告。
以下示例生成 C4792:
// C4792.cpp
// compile with: /clr /W3
// C4792 expected
using namespace System::Runtime::InteropServices;
[DllImport("msvcrt")]
extern "C" int __cdecl puts(const char *);
int main() {}
// Uncomment the following line to resolve.
// #pragma warning(disable : 4792)
#pragma unmanaged
void func(void){
puts("test");
}
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈