[英]Compiling libcurl with Visual Studio (bool undefined)
I want to compile curl from source inside a Visual Studio project. 我想从Visual Studio项目中的源代码编译curl。
I get this error (and a lot more): 我收到此错误(还有更多):
curl\src\tool_sdecls.h(67): error C2061: Syntax Error: Identifier'bool' (..\..\..\framework\libs\curl\src\tool_cb_dbg.c)
curl\src\tool_sdecls.h(68): error C2061: Syntax Error: Identifier'bool'is_cd_filename' (..\..\..\framework\libs\curl\src\tool_cb_dbg.c)
curl\src\tool_sdecls.h(68): error C2059: Syntax Error: ';' (..\..\..\framework\libs\curl\src\tool_cb_dbg.c)
The source of this file is: 该文件的来源是:
65: struct OutStruct {
66: char *filename;
67: bool alloc_filename;
68: bool is_cd_filename;
69: bool s_isreg;
...
It looks like bool
is not defined for some reason. 似乎由于某种原因未定义
bool
。 I tried defining HAVE_BOOL_T
but nothing changed. 我尝试定义
HAVE_BOOL_T
但没有任何改变。
Any idea? 任何想法? Thanks
谢谢
To solve the problem I added the folowing to curl_config.h
为了解决该问题,我将以下内容添加到
curl_config.h
//for undefined bool error
#if _MSC_VER > 1700
#include <stdbool.h>
#else
#ifndef bool
typedef int bool;
#define false 0
#define true 1
#endif
#endif
//for warning C4005: 'POLLIN' : macro redefinition error
#define _WIN32_WINNT 0x0501
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.