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???"