I have a MainWindow class setup using Qt in Visual Studio. In the mainwindow.cpp file I have created a thread using pthread called 'solder_thread' which when created calls another function called 'perform_solder'. Inside this 'perform_solder', I am trying to access functions and variables declared in the MainWindow class, but I get an error message which says 'IntelliSense: identifier "move_stage_solder" is undefined'
mainwindow.cpp:
#include "mainwindow.h"
void * perform_solder(void * arg);
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
connect(ui->pb_feeder, SIGNAL(clicked()), SLOT(enable_feeder_arduino()));
}
void MainWindow::enable_feeder_arduino(){
pthread_t solder_thread;
if (pthread_create(&solder_thread, NULL, &perform_solder, NULL)){
ui->status_message->setText("Error in creating the serial communication thread");
exit(-1);
}
}
void MainWindow::move_stage_solder(double xpos, double ypos){
/*Do something*/
}
void * perform_solder(void * arg){
move_stage_solder(0,0); /*This is where the error shows up*/
}
Bookmarks