请教c++ thread 如何在主函数以外的一个函数里调用其他的函数

qq_16946955 2018-06-13 03:48:24
#include"stdafx.h"
#include <iostream>
#include <thread>
using namespace std;
void Judge(int x, int y, int z)
{
thread taskUD(UDjudge, x, y, z);
taskUD.detach();
}
int UDjudge(int x,int y,int z)
{
.........
}
int main()
{
int x,y,z;
Judge(x,y,z);
return 0;
}
像是这样的,在VS2017编译时会显示在thread那一行.显示"UDjudge"是未定义的标识符,错误代码C2065
请问这该如何解决?
...全文
590 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
这个函数:int UDjudge(int x,int y,int z)放到void Judge(int x, int y, int z)前面。
  • 打赏
  • 举报
回复
using namespace std; int UDjudge(int x,int y,int z); 加上函数声明试试

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧