I'm developing an application in Visual Studio with Cpp. Under normal conditions, we can call multithreading software from the main and we don't get any errors. But why am I getting this error here?
#include <thread>
This is the code inside my Method.
private: void Getmessage()
{
uint16_t Register_List[1];
mb.modbus_read_holding_registers(1, 0, Register_List);
label1->Text= System::Convert::ToString(Register_List);
}
This is the code inside my one button event.
public: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
label1->Text = "ok";
mb.modbus_set_slave_id(1);
mb.modbus_connect();
if (mb.is_connected())
{
label2->Text = "connected";
std::thread first(Getmessage);
first.join();
}
else
{
label2->Text = "Error";
}
};
I was able to do this comfortably on other platforms, but here I am getting this error. Error : No instance of constructor "std::thread::thread" matching argument list.
I tried a lot of things I researched and went back to the simplest.