标签: pelles-c

在pelles c中,windows.h无法编译

我正在使用pelles c.当我编译这段代码时:

#include <windows.h>
#include <stdio.h>

void main(void)
{
   printf("Hello World");
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

D:\Program Files\PellesC\Include\Win\basetsd.h(53): error #2001: Syntax error: expected ';' but found 'INT64'.
D:\Program Files\PellesC\Include\Win\basetsd.h(53): warning #2099: Missing type specifier; assuming 'int'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): error #2120: Redeclaration of '__int64', previously declared at D:\Program Files\PellesC\Include\Win\basetsd.h(53); expected 'int' but found 'unsigned int'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): error #2001: Syntax error: expected ';' but found 'UINT64'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): warning #2099: Missing type specifier; assuming 'int'.
D:\Program Files\PellesC\Include\Win\winnt.h(558): fatal error #1014: #error: "No target architecture". …
Run Code Online (Sandbox Code Playgroud)

c header-files pelles-c

2
推荐指数
1
解决办法
5223
查看次数

无法获得SHGetKnownFolderPath()函数的工作

我在使用SHGetKnownFolderPath()函数时遇到了麻烦.我收到以下错误消息: Type error in argument 1 to 'SHGetKnownFolderPath'; expected 'const struct _GUID *' but found 'struct _GUID'.

KnowFolders.h我们有以下相关定义:

#define DEFINE_KNOWN_FOLDER(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
    EXTERN_C const GUID name
...
DEFINE_KNOWN_FOLDER(FOLDERID_ProgramFiles,0x905e63b6,0xc1bf,0x494e,0xb2,0x9c,0x65,0xb7,0x32,0xd3,0xd2,0x1a);
Run Code Online (Sandbox Code Playgroud)

我正在使用Pelles C编译器.

这是我的示例代码:

#include <windows.h>
#include <wchar.h>
#include <KnownFolders.h>
#include <shlobj.h>

int wmain(int argc, wchar_t **argv) {

    PWSTR path = NULL;

    HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramFiles, 0, NULL, &path);    

    if (SUCCEEDED(hr)){

        wprintf(L"%ls", path);
    }

    CoTaskMemFree(path);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

如何修复此错误消息?

编辑我找到了SHGetKnownFolderPath()的代码示例; 所有这些都在没有指针的情况下执行函数.例如:

hr = SHGetKnownFolderPath(FOLDERID_Public, 0, NULL, &pszPath);
if (SUCCEEDED(hr))
{
    wprintf(L"FOLDERID_Public: …
Run Code Online (Sandbox Code Playgroud)

c c++ winapi pelles-c

2
推荐指数
1
解决办法
9607
查看次数

带有颗粒的怪异输出c

float f=44268/107402;
printf("\n%f",f);
Run Code Online (Sandbox Code Playgroud)

输出:

0.000000

怎么会发生这种情况!

我在win 7上使用了pelles c ide.

c pelles-c

0
推荐指数
1
解决办法
279
查看次数

标签 统计

c ×3

pelles-c ×3

c++ ×1

header-files ×1

winapi ×1