在Windows上使用clang进行编译会产生奇怪的错误

时间:2016-10-06 22:11:09

标签: c clang llvm

我正在尝试创建一个简单的程序来创建一个消息框,以便在Windows上使用clang进行编译

#include <Windows.h>

int main() {
    MessageBoxA(0, "text", "title", 0);

    return 0;
}

Clang最初说它无法找到Windows.h,但是当我向C:\MinGW\include提供-I时,它会产生一些错误,这些错误似乎表明clang无法正确预处理c

C:\MinGW\include\winsock2.h:545:47: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
                                              ^
C:\MinGW\include\winsock2.h:554:57: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
                                                        ^
C:\MinGW\include\winsock2.h:555:57: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
                                                        ^
C:\MinGW\include\winsock2.h:556:57: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
                                                        ^
C:\MinGW\include\winsock2.h:557:57: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
                                                        ^
C:\MinGW\include\winsock2.h:558:58: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
                                                         ^
C:\MinGW\include\winsock2.h:559:58: error: expected function body after function declarator
WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
                                                         ^
1 warning and 16 errors generated.

我应该尝试一下或者在Windows上铿锵得不够成熟吗?

0 个答案:

没有答案