Hello,
I want to make use of QuantLib, especially for converting a date into a serialnumber.
When I run the program below I get the error:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall QuantLib:ate:ate(int,enum QuantLib::Month,int)" (??0Date@QuantLib@@QAE@HW4Month@1@H@Z) referenced in function "private: class QuantLib:ate __thiscall MainWindow::date1(void)const " (?date1@MainWindow@@ABE?AVDate@QuantLib@@XZ)
I tried a lot, but still can't figure it out.
Can someone give me a hint?
Regards,
Arend
My .pro file:
QT += core gui
INCLUDEPATH += . C:/Libs/boost_1_46_1 C:/Libs/QuantLib-1.1
LIBS += -LC:/Libs/QuantLib-1.1/lib
TARGET = testQuantLib
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
QT += core gui
INCLUDEPATH += . C:/Libs/boost_1_46_1 C:/Libs/QuantLib-1.1
LIBS += -LC:/Libs/QuantLib-1.1/lib
TARGET = testQuantLib
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
To copy to clipboard, switch view to plain text mode
My .h file
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <ql/time/date.hpp>
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QuantLib::Date date1() const;
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <ql/time/date.hpp>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QuantLib::Date date1() const;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
Mu .cpp file:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
QuantLib::Date dateOld=this->date1();
}
MainWindow::~MainWindow()
{
delete ui;
}
QuantLib::Date MainWindow::date1() const {
QDate date
=ui
->curveDate
->date
();
QuantLib::Date d(date.day(),(QuantLib::Month)date.month(),date.year());
return d;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QuantLib::Date dateOld=this->date1();
}
MainWindow::~MainWindow()
{
delete ui;
}
QuantLib::Date MainWindow::date1() const {
QDate date=ui->curveDate->date();
QuantLib::Date d(date.day(),(QuantLib::Month)date.month(),date.year());
return d;
}
To copy to clipboard, switch view to plain text mode
Added after 23 minutes:
I solved it: added #include <ql/auto_link.hpp> somewhere in the program.
Bookmarks