将功能从控制台应用程序移动到共享库项目似乎会带来不相关的编译错误

Moving function from console application to shared library project seem to bring unrelated compilation error

我的解决方案有几个 C++ 控制台应用程序。该解决方案还有一个项目构建为静态库 (.lib)。该库在所有控制台应用程序中用于任何通用功能。所有这些项目还使用各种增强库。

最近需要在其他 applications.I 中重用控制台应用程序中的函数,因此决定将该函数从控制台应用程序移出到静态库中。但是,这样做会带来以下编译错误。

c:\mySolution\packages\boost.1.69.0.0\lib\native\include\boost\asio\detail\impl\win_thread.ipp(90): error C2039: '_beginthreadex': is not a member of '`global namespace''
c:\mySolution\packages\boost.1.69.0.0\lib\native\include\boost\asio\detail\impl\win_thread.ipp(90): error C3861: '_beginthreadex': identifier not found

此函数使用 boost::process 库,它在控制台应用程序中运行良好。但是,当我将相同的函数移动到共享库项目中时,我开始看到此错误。没有其他警告,也没有指向我的任何应用程序代码。知道这个错误背后的原因是什么吗?

documentation,你需要#include <process.h>。 (我在下面使用引用的代码块来允许 table 格式化...)

Requirements

Routine               Required header

_beginthread          <process.h>
_beginthreadex        <process.h>