(Visual Studio 2010/Visual C++/Windows 7)
例子.cpp:
#include <Shlobj.h>
#pragma comment (lib, "Shell32.lib")
...
void example()
{
SHGetKnownFolderPath(...) // undefined
}
我正在根据 documentation 做所有事情以及我在其他线程中看到的,但它仍然不起作用。
最佳答案
我遇到了完全相同的问题。另一个具有相同代码和辅助文件(但包含不同)的项目正在运行。
放 #include <Shlobj.h>
在文件顶部解决了问题。
虽然它可能无法复制,因为它应该在不这样做的情况下工作。可能是另一个 Visual Studio 错误。
关于c++ - 即使使用#include <Shlobj.h> 和#pragma 注释(lib, "Shell32.lib")也无法调用 SHGetKnownFolderPath(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22379195/