I need a GUI application to display the contents of myFunction. I have a working console application.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLibrary>
#include <QLineEdit>
MainWindow
::MainWindow(QWidget *parent
){
ui->setupUi(this);
typedef char* (*MyPrototype)();
MyPrototype myFunction
= (MyPrototype
) QLibrary::resolve("dllprog",
"TestDll");
char* b = myFunction();
ui->lineEdit->setText(b);
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLibrary>
#include <QLineEdit>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindowClass)
{
ui->setupUi(this);
QLibrary myLib("dllprog");
typedef char* (*MyPrototype)();
MyPrototype myFunction = (MyPrototype) QLibrary::resolve("dllprog", "TestDll");
char* b = myFunction();
ui->lineEdit->setText(b);
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
This is my code display the characters that myFunction returns in a linedit.
I have created a pushButton and a lineEdit in the .ui file.
I am getting this error.
:-1: error: collect2: ld returned 1 exit status
How can i solve this?
thanks for reading.
Bookmarks