C++ “没有构造函数实例”;标准::螺纹::螺纹“;匹配参数列表
我正在尝试制作一个周五晚上的funkin'AI。我尝试使用线程,因为没有线程需要很长时间,但它们不起作用C++ “没有构造函数实例”;标准::螺纹::螺纹“;匹配参数列表,c++,C++,我正在尝试制作一个周五晚上的funkin'AI。我尝试使用线程,因为没有线程需要很长时间,但它们不起作用 #include <iostream> #include <windows.h> #include <conio.h> #include <thread> using namespace std; void left(int a) { HDC _hdc = GetDC(NULL); COLOR
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <thread>
using namespace std;
void left(int a) {
HDC _hdc = GetDC(NULL);
COLORREF l = GetPixel(_hdc, 1105, 177);
if ((int)GetRValue(l) == 194 && (int)GetGValue(l) == 75 && (int)GetGValue(l) == 153 || (int)GetRValue(l) == 170 && (int)GetGValue(l) == 110 && (int)GetGValue(l) == 161) {
keybd_event(VK_LEFT, 0, KEYEVENTF_EXTENDEDKEY, 0);
}
else {
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
std::cout << a;
}
}
void right(int b) {
//right
HDC _hdc = GetDC(NULL);
COLORREF r = GetPixel(_hdc, 1583, 164);
if ((int)GetRValue(r) == 249 && (int)GetGValue(r) == 57 && (int)GetGValue(r) == 63 || (int)GetRValue(r) == 203 || (int)GetGValue(r) == 99 || (int)GetGValue(r) == 107) {
keybd_event(VK_RIGHT, 0, KEYEVENTF_EXTENDEDKEY, 0);
}
else {
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
}
cout << b;
}
int main()
{
while (!GetAsyncKeyState(0x57)) {
std::thread ri(right, 10);
std::thread le(left, 10 );
}
}
"
适用于我-变成了一个-活动-现在添加代码,直到代码中断。不要使用
使用namespce std代码>,通过包含您包含了
,它定义了std::left
,std::right
。编译器不知道要传递给线程构造函数参数的左,是您的参数还是
中定义的参数。您可以编写std::thread ri(::right,10)
选择全局版本。对左侧的执行相同的操作。
'std::thread::thread': no overloaded function takes 2 arguments