知道如何将此代码从 C# 移植到 C++ 吗?
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
private static extern int StrCmpLogicalW(string psz1, string psz2);
如果我在 C++ 的头文件中尝试这一行,编译器会生成一堆错误。
#include <Shlwapi.h>
最佳答案
错误是链接器错误,因为您没有包含相应的 .lib 文件 Shlwapi.lib。
您可以在项目设置中包含 .lib 文件,或者通过添加此文件
#pragma comment(lib, "Shlwapi.lib")
例如,StdAfx.h。
关于c++ - 将 shlwapi.h 链接到 StrCmpLogicalW 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5782047/