我在 Visual Studio 2010(Windows 窗体)中遇到了 SHGetFolderPathA 的问题。我包含到项目中ShlObj.h
并为按钮添加了此代码:
char SciezkaCookies[MAX_PATH];
HRESULT hr = ::SHGetFolderPathA(0, CSIDL_APPDATA, 0, SHGFP_TYPE_DEFAULT, SciezkaCookies);
但是当我尝试编译我的项目时,视觉返回错误:
错误 LNK2028:未解析的令牌 (0A000012) “extern "C" long stdcall SHGetFolderPathA(struct HWND *,int,void *,unsigned long,char *)" (?SHGetFolderPathA@@$$J220YGJPAUHWND__@@HPAXKPAD@Z) 在函数中引用“私人:void __clrcall VoxPopuli::Form1::start_Click(类 System::Object ^,类 System::EventArgs ^)”(?start_Click@Form1@VoxPopuli@@$$FA$AAMXP$AAVObject@System@@P$ AAVEventArgs@4@@Z)
和
1>VoxPopuli.obj : 错误 LNK2019: 无法解析的外部符号 "extern "C" long stdcall SHGetFolderPathA(struct HWND *,int,void *,unsigned long,char *)" (?SHGetFolderPathA@@$$J220YGJPAUHWND__@@HPAXKPAD@Z ) 在函数“private: void __clrcall VoxPopuli::Form1::start_Click(class System::Object ^,class System::EventArgs ^)”中引用 (?start_Click@Form1@VoxPopuli@@$$FA$AAMXP$AAVObject@System @@P$AAVEventArgs@4@@Z)
我正在谷歌中寻找解决方案,但所有示例都不起作用;/
感谢帮助!