我想在Qt创建者中使用DELAYLOAD
标志。这是解释我的问题的最小代码:
在pro
文件中:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = DelayLoad
TEMPLATE = app
CONFIG+=qwt
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
win32: LIBS += -L$$PWD/../../../../../qwt-6.1.2/lib/ -lqwt
INCLUDEPATH += $$PWD/../../../../../qwt-6.1.2/include
DEPENDPATH += $$PWD/../../../../../qwt-6.1.2/include
win32: QMAKE_LFLAGS_RELEASE += /DELAYLOAD:qwt.dll
在mainwindow.cpp
:
#include "mainwindow.h"
#include <QPushButton>
#include "qwt_plot.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QPushButton *button = new QPushButton("replace by plot");
connect(button, SIGNAL(clicked(bool)),this,SLOT(buttonClicked()));
this->setCentralWidget(button);
}
MainWindow::~MainWindow()
{
}
void MainWindow::buttonClicked()
{
QwtPlot *plot = new QwtPlot();
this->setCentralWidget(plot);
}
这会出现以下错误:
qwt.lib(qwt.dll):-1: error: LNK2001: unresolved external symbol __delayLoadHelper2
我点击了Run qmake
,Clear
,Rebuild
上的几个。这并不能解决最初的问题。我正在使用Qt 5.4.2&#39;使用MSVC 2013 64 bit
编译器
答案 0 :(得分:0)
将以下行添加到.pro文件中。
win32:LIBS += "-LC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" -ldelayimp