Pra*_*hat 2 c c++ intellisense visual-studio
我收到以下错误:
argument of type "const char *" is incompatible with parameter of type "LPCWSTR"
这是我的代码:
static char *getFmuPath(const char *fileName) {
char pathName[MAX_PATH];
int n = GetFullPathName(fileName, MAX_PATH, pathName, NULL);
return n ? strdup(pathName) : NULL;
}
Run Code Online (Sandbox Code Playgroud)
我已经声明了,MAX_PATH但是路径名仍然显示错误
#define MAX_PATH 4096
Run Code Online (Sandbox Code Playgroud)
问题是什么 ?
GetFullPathName不需要char *。查看文档,它需要LPTSTR和LPCTSTR。
根据您的构建设置,LPTSTR相关的类型将变为char*(ANSI构建)或wchar_t*(Unicode构建)。您正在构建为Unicode。
另外,我不知道您为什么要定义MAX_PATH。这是Windows常量,因此您不应重新定义它。
| 归档时间: |
|
| 查看次数: |
10440 次 |
| 最近记录: |