Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
So I've been having a lot of trouble getting it all to work with MSVC 64 compiler, and decided to put these simple steps which could have save me few hours if I knew it before.
My goal was to be able to plot, I am not interested in neither knobs/sliders nor the QtCreator integration, as a result this manual won't cover it. Just pure plotting capabilities and nothing else. Also, I wanted it to work with MSVC 64, because I build my Qt 64-bit applications with that compiler.
1) Make sure you have Qt installed with MSVC 2015 64-bit compiler
2) Go ahead download and install Microsoft Visual Studio Community 2015 to the default path
3) download the Qwt source zip file, and extract it to: C:\Qwt-6.1.3
4) Edit the qwtconfig.pri inside the C:\Qwt-6.1.3 folder, specifically, make sure that QWT_INSTALL_PREFIX is loaded in such a way that it points to C:\Qwt-6.1.3 and also comment out the following lines:
QWT_CONFIG += QwtWidgets
QWT_CONFIG += QwtDesigner
5) Next, open the command shell of Qt from the start Menu, Windows START MENU->Qt->5.7->MSVC 2015 (64-bit)->Qt 5.7 64-bit for Desktop (MSVC 2015), you will see the following message:
Quote:
Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!
6) Now, do the following command: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC and that is the directory where you installed your MSVC Community 2015
7) Run this command: vcvarsall.bat amd64
8) Now go to Qwt folder: C:\Qwt-6.1.3
9) Run this: qmake qwt.pro
10) now run this: nmake
11) finally run this: nmake install
12) Create some simple gui application in QtCreator, so that it only has a main.cpp file, and enter this code (taken from here):
Code:
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
int main( int argc, char **argv )
{
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.
setAxisScale( QwtPlot::yLeft,
0.0,
10.0 );
grid->attach( &plot );
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true );
curve->setSymbol( symbol );
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
13) in the .pro file of your application include this line: include (C:\Qwt-6.1.3\features\qwt.prf)
14) run qmake, build and run, it will work now, so this way if you are building 64bit programs with MSVC, they will be able to work with your 64 bit MSVC built Qwt plot libraries.
NOTES: * Again, I did not need sliders/knobs or QtCreator integration, so I turned it off. If you are also fine with this then this manual is for you
* pay attention at step #7, you must provide "amd64" argument to that .bat file, in order to make it 64 bit. Let the "amd" word not confuse you (as it did me and I lost some time with this) because even x64 platform also defaults to amd64 in that BAT file.
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
Better don't use the same directory for the Qwt source directory and where you install Qwt ( Step 3 and 4 ). It is not necessary and even if it works ( never tried it myself ) it might cause confusion.
If you are not interested in the source code or the examples you could even remove the source directory from disk after installation - everything you need for your application is in the install directory then.
When trying to build the designer plugin you often need to build and install Qwt twice ( at different locations ), where your strategy of having the same directory for building and installing can't work anymore.
In the end the only step, that is not mentioned in the Qwt installation documentation is Step 7 - everything else is individual configuration related, what usually differs for others.
As I had many, many problems with homebrew installation guides in the past - please always try to understand and follow the official installation guide step by step: http://qwt.sourceforge.net/#installonmainpage
Uwe
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
ok, so the only modification to the manual is, in step #3 extract it to C:\Qwt-6.1.3_src and everything else stays same.
And step #7 is the most critical thing here which was big part of my confusion and LNKxxxx errors and lost time. Without that step, the Windows->MSVC subsection of the manual here http://qwt.sourceforge.net/qwtinstall.html is incomplete...
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
I'm agree with r2com.
I install qt-opensource-windows-x86-msvc2015_64-5.8.0 and Visual Studio 2015 on Windows 10. Everything works fine. I compile QT project in Visual Studio.
When I want to compile qwt-6.1.3 (following the official instructions), I have this error:
fatal error LNK1112: type d'ordinateur module 'x64' en confilt avec le type d'ordinateur cible 'X86'
(sorry it's a french version of windows :) )
The problem is the same when I add the instruction 7. of r2com. I have the same result. :(
When I type 'vcvarsall.bat amd64' in the MSVC path, nothing happens (no files change in the MSVC directory).
Some one have a solution ?
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
Sorry it's Windows 7 pro and not Windows 10.
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
Looks like a 32 vs. 64 bit incompatibility between libraries needed when linking the application.
Uwe
Re: Installing Qwt with MSVC-2015 64bit compiler on Windows (complete instructions)
Hello everyone. Sorry for my bad english. :)
There is change in point 6 if you want to use Qwt with MSVC-2017 64bit compiler. Now the command is C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build>vcvarsall .bat amd64.
It works. I use W10 version 1703 (compilation 15063.726), with Qt Creator 4.4.1 Based on Qt 5.9.3 (MSVC 2015, 32 bit). I use Desktop Qt5.9.3 MSVC2017 64bit Kits to test the examples.
Greetings