我正在尝试在 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
Run Code Online (Sandbox Code Playgroud)
在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);
}
Run Code Online (Sandbox Code Playgroud)
这会产生以下错误:
qwt.lib(qwt.dll):-1: 错误: LNK2001: 无法解析的外部符号 __delayLoadHelper2
我点击了几个Run qmake
,,Clear
。Rebuild
这并不能解决最初的问题。我正在使用“Qt 5.4.2”和MSVC 2013 64 bit
编译器
小智 3
将以下行添加到 .pro 文件中,没错。
win32:LIBS += "-LC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" -ldelayimp
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2609 次 |
最近记录: |