【C++ 11】 error C3861: ‘_beginthreadex‘: identifier not found

在将项目从Visual Studio 2008迁移到2013时遇到了C3861错误,问题在于找不到'_beginthreadex'标识符。解决方法是正确包含<crtdefs.h>和<process.h>,特别是<crtdefs.h>会定义/_CRT_USE_WINAPI_FAMILY_DESKTOP_APP,使得_process.h_中的_beginthreadex_可用。在MFC应用中,建议使用AfxBeginThread代替。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【C++ 11】 error C3861: ‘_beginthreadex’: identifier not found

这个问题 在使用 多线程 操作的时候遇到的很少, 一旦遇到 第一个 反应 应该是 process.h 冲了。
这也是 概率 问题。

我正在尝试将项目从VS2008转换为VS2013,而我遇到的问题之一就是:

c:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\atlbase.h(4953): error C3861: '_beginthreadex': identifier not found

我在网上搜索了一个解决方案,我已经在我的StdAfx.h中包含了process.h,(不确定它是否重要,但我把它放在#include和#include之下,否则我会收到一个“ Windows.h“已包含错误”。

你需要:

#include <crtdefs.h>
#include <process.h>
crtdefs.h将定义/取消定义_CRT_USE_WINAPI_FAMILY_DESKTOP_APP,其中_beginthreadex包含在process.h中。

您必须包含process.h才能访问此功能。

MFC应用程序内部,您应该使用AfxBeginThread

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值