[Solved]Error in building Qt5.4 with MS Visual Studio 2010
-
Hi, I am trying to use Qt in MS Visual Studio. I made a simple App using a pushButton to open a picture. But when I run the program, it prompts:
error LNK2019: unresolved external symbol "private: void __thiscall myQtOpenCV::Open(void)"
Open(void) is the slot function connected to the pushButton. It seems Open function is not working.
I am not very good at programing, so I hope someone can help me to solve this problem. -
Hi and welcome to devnet,
Might be a silly question but did you implement that slot ? Even if it does nothing you need it.
-
Thanks for your reply.
I implemented it simply with OpenCV functions in the .cpp file:
@void Open()
{
cv::Mat image = cv::imread("image.jpg");
cv::namedWindow("Original Image");
cv::imshow("Original Image", image);
}
@
I can’t see where I went wrong. Here is the code in the .h file.
@#ifndef MYQTOPENCV_H
#define MYQTOPENCV_H#include <QtWidgets/QMainWindow>
#include <QFileDialog>
#include "ui_myqtopencv.h"
#include "opencv2/opencv.hpp"class myQtOpenCV : public QMainWindow
{
Q_OBJECTpublic:
myQtOpenCV(QWidget *parent = 0);
~myQtOpenCV();private:
Ui::myQtOpenCVClass ui;private slots:
void Open();
};#endif // MYQTOPENCV_H
@ -
I have solved this problem. Just my silly mistake. The function should be implemented like this @void myQtOpenCV::Open(){}@