Installing (or using?) Qwt without compiling the Qt Creator
Is there any way for me to use the Qwt without compiling the Qt Creator?
And by the way my Qt Creator is: Based on Qt 5.7.0 (MSVC 2013, 32 bit)
And even if I still must build Qwt in order to use it, can it be done by building it from Qt Creator itself?
Again, all I want is to be able to generate plots inside my program, if I do not get those drag/drop Qwt controls (which I do not need anyway) I am perfectly fine with it.
I just need to be able to call Qwt functions to plot data inside my window widgets (and also plot using OpenGL)
I even tried this, I extracted the qwt-6.1.3 folder, and opened its .pro file with my Qt Creator, built it. then created a simple gui project in QtCreator, and:
.pro file:
Code:
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-09T16:55:09
#
#-------------------------------------------------
QT += core gui
CONFIG += qwt
QWT_LOCATION = C:\Qwt-6.1.3
INCLUDEPATH += $${QWT_LOCATION}/src
LIBS = -L$${QWT_LOCATION}/lib \
-lqwt
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QwtTest2
TEMPLATE = app
SOURCES += main.cpp
HEADERS +=
FORMS +=
And here is the main.cpp (some code I took as example from some of the threads in 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();
}
It compiles without error, but when I run it it shows this in Application Output:
Quote:
QWidget: Must construct a QApplication before a QWidget
ANy ideas how can I get it to work?
Re: Installing (or using?) Qwt without compiling the Qt Creator
Quote:
Originally Posted by
r2com
Is there any way for me to use the Qwt without compiling the Qt Creator?
As long as you don't want to get the designer plugin running ( where I don't see, that you need it ) the Qt Creator is unrelated to the application and the libraries ( f.e Qwt ) used for building it. So recompiling the Creator won't change anything.
Quote:
QWidget: Must construct a QApplication before a QWidget
This is a standard symptom, when linking incompatible binaries. The incompatibility should be between the Qt library you are building your application with and the version you have used for building the Qwt library - often simply a debug/release mismatch.
Your project file also indicates, that you didn't follow the installation process - skipping the "make install" step. Most of the problems with building and running Qwt applications have to do with not doing it carefully, then trying to fix things manually ( like adding include + link paths to the source directory ) ...
http://qwt.sourceforge.net/qwtinstal...PILEANDLINKAPP is all that needs to be done - as soon as you have to add extra include/link paths to your project files you know, that something is wrong.
Uwe
Re: Installing (or using?) Qwt without compiling the Qt Creator
Alright, I'm now following then the manual you linked, I passed the stage where I ran "qmake qwt.pro" and the Makefile was created.
Then I made sure I have the MSVC 2013 compiler and added location of folder with nmake.exe to the PATH.
but after I ran nmake, I got errors like:
Quote:
3: Cannot open include file: 'cstddef': No such file or directory
qwt_color_map.cpp
..\..\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore\qg lobal.h(45) : fatal error C108
3: Cannot open include file: 'cstddef': No such file or directory
qwt_column_symbol.cpp
..\..\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore\qg lobal.h(45) : fatal error C108
3: Cannot open include file: 'cstddef': No such file or directory
qwt_date.cpp
..\..\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore\qg lobal.h(45) : fatal error C108
3: Cannot open include file: 'cstddef': No such file or directory
qwt_date_scale_draw.cpp
..\..\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore\qg lobal.h(45) : fatal error C108
3: Cannot open include file: 'cstddef': No such file or directory
qwt_date_scale_engine.cpp
Any ideas?
Added after 1:
OK, I tried from scratch, here are my steps:
1) Install MSVC 2013, add its folder containing nmake to system PATH
2) run the vcvars32.bat file inside the bin folder within MSVC 2013 install
3) go to Qwt folder, run "qmake qwt.pro"
4) run nmake,
at step #4 I got now this error:
Quote:
Generating Code...
linking ..\lib\qwt.dll
Qt5OpenGL.lib(Qt5OpenGL.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
NMAKE : fatal error U1077: 'echo' : return code '0x458'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Why is there still such a conflict?
Re: Installing (or using?) Qwt without compiling the Qt Creator
I tried from scratch, this time, again extracted the whole Qwt archieve then
1) installed Qt with Mingw 5.3 32 bit
2) configure Qwt not to include QtDesigner plugin in the .pri file,
3) open the command window from Qwt submenu, navigate to Qwt folder with extracted files, ran qmake qwt.pro
4) run mingw32-make
5) run mingw32-make install
those are the 3 lines described in manual... I am clearly following it, however; the process does not go well.
For example, even when I ran qmake, for some reason it complained about the fact that system cannot find file specified, although it did create the Makefile
Also, I do not see any .LIB files in the lib folder...
Next, I tried compile the above example, with the CONFIG += qwt line in the .pro file, and it says qwt.lib cannot open that file..
Again, following the manual from http://qwt.sourceforge.net/qwtinstal...PILEANDLINKAPP just does not work!
There gotta be some intermediate step to be taken and I am not sure exactly what.
So I'm trying to figure out how to get it to work...
Added after 19 minutes:
When I tried to add this in qmake for my project application: qmake -set QMAKEFEATURES ${QWT_ROOT}/features I got the error: "***Unknown option -set"
And when I tried using the: "include ( ${QWT_ROOT}/features/qwt.prf )" (actually that command did not work, I had to place qwt.prf inside project folder)
It then says:
Quote:
C:\Users\projs\CloudStation\Qt\QwtTest2\qwt.prf:37 : error: 'qwtAddLibrary' is not a recognized test function.
Added after 20 minutes:
Ok, I also copied qwtconfig.pri and qwtfunctions.pri to the project folder, but now my error is:
Quote:
LINK : fatal error LNK1104: cannot open file 'qwtd.lib'
Apparently I cannot find the qwtd.lib myself either, so I assume the build process went wrong and file was not created?
Re: Installing (or using?) Qwt without compiling the Qt Creator
Quote:
For example, even when I ran qmake, for some reason it complained about the fact that system cannot find file specified, although it did create the Makefile
No idea without seeing, what went wrong.
Quote:
Also, I do not see any .LIB files in the lib folder...
This is normal - there is no reason for having such directory.
So what exactly goes wrong and what is the output of the command that goes wrong ?
All files to be installed land inside the directory you have specified as installdir in the qwtconfig.pri. Does it look o.k. to you ?
Of course you have to use the real directory, QWT_ROOT is only a placeholder.
Uwe
Re: Installing (or using?) Qwt without compiling the Qt Creator
OK, I'm about to start from scratch. One more question before I do it again:
in case if I do not want Qwt to be integrated with UI controls in Qt designer, and let's say I compiled it with mingw 32bit, will I be able to use the Qwt plot with my application which is compiled with 64bit MSVC, or not?
Or in that case the Qwt also needs to be compiled with 64 bit MSVC?
Re: Installing (or using?) Qwt without compiling the Qt Creator
You can't link 64 and 32 bit - or in any other way incompatible - binaries. But this is in general and has nothing to do in particular with Qwt.
Uwe
Re: Installing (or using?) Qwt without compiling the Qt Creator
ok got it, here is one strange thing, if I follow your manual, and let's say I decide to use MSVC 64 bit, which is installed during installation of Qt,
If I go to Qt dev console under the MSVC 64 bit tool folder, I cannot run nmake there.. it says command is not found, because nmake.exe is literally not in the C:\Qt\5.7\msvc2015_64\bin folder
So which "nmake" does your manual assume me to run?
Because from one side, it recommends me to run those commands within the Qt console environment, which is what I'm doing, but on another hand, nmake cant be run.. so?
Re: Installing (or using?) Qwt without compiling the Qt Creator
OK finally I got it to work, and decided to make it easier for those who need same thing and put my instructions to a clean new topic here