Poco 1.4.2 在Windows平台下使用时link报错 "CreateProcess is not defined"的解决

在Windows平台使用Poco 1.4.2时遇到link错误"CreateProcess is not defined"。问题源于Poco库中的宏undef。解决方案是在包含Poco头文件前#define POCO_NO_UNWINDOWS,避免Poco库与系统定义冲突。
摘要由CSDN通过智能技术生成


Poco 1.4.2 在Windows平台下使用时link报错 "CreateProcess is not defined"


原因:Poco库中 undef 了 CreateProcess 宏


ps, 定位问题的过程:

0 ) 刚开始不知道这个问题是POCO库引起的...

1) 查看 MSDN CreateProcess 的说明,确保本工程定义的WINVER, _WIN32_WINNT, _WIN32_WINDOWS, _WIN32_IE 版本确实能使用 CreateProcess 

2 )   郁闷了

3 )  自己在.cpp中加入 CreateProcess 的宏定义,发现问题解决了...

#ifndef CreateProcess
//#error "why CreateProcess is not defined?"
// Why???
#ifdef _UNICODE
#define CreateProcess CreateProcessW
#else
#define CreateProcess CreateProcessA
#endif // _UNICODE
#endif

4 ) 上面的解决方法看起来太猥琐了...

5 ) 由上可证,问题是由于 CreateProcess 宏没有定义引起的

6 )  在调用了CreateProcess  函数的.cpp文件的头部加入:

#ifundef CreateProcess
#error "why???"
#endif

编译,发现在最顶部的时候不会走到 #error "why???"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值