无法调用SHGetKnownFolderPath(),即使使用#include< Shlobj.h>和#pragma comment(lib,“Shell32.lib”) [英] Unable to call SHGetKnownFolderPath() even with #include <Shlobj.h> and #pragma comment (lib, "Shell32.lib")

查看:787
本文介绍了无法调用SHGetKnownFolderPath(),即使使用#include< Shlobj.h>和#pragma comment(lib,“Shell32.lib”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(Visual Studio 2010 / Visual C ++ / Windows 7)

(Visual Studio 2010 / Visual C++ / Windows 7)

example.cpp:

example.cpp:

#include <Shlobj.h>
#pragma comment (lib, "Shell32.lib")    
...
void example()
{
    SHGetKnownFolderPath(...) // undefined
}



我根据文档和我在其他线程中看到的,但它仍然不工作。

I'm doing everything according to documentation and what I see in other threads, but it still doesn't work.

推荐答案

我有同样的问题。

放置 #include< Shlobj.h> 在文件的顶部解决了问题。

Putting #include <Shlobj.h> at the top of the file solved the problem.

它可能不可复制,虽然,因为它应该没有这样做的工作。可能是另一个Visual Studio错误。

It might not be replicable though, as it should have worked without doing that. Probably another Visual Studio bug.

这篇关于无法调用SHGetKnownFolderPath(),即使使用#include&lt; Shlobj.h&gt;和#pragma comment(lib,“Shell32.lib”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆