Results 1 to 9 of 9

Thread: Installing (or using?) Qwt without compiling the Qt Creator

  1. #1
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Question 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:
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2016-08-09T16:55:09
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8. CONFIG += qwt
    9. QWT_LOCATION = C:\Qwt-6.1.3
    10. INCLUDEPATH += $${QWT_LOCATION}/src
    11. LIBS = -L$${QWT_LOCATION}/lib \
    12. -lqwt
    13.  
    14.  
    15. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    16.  
    17. TARGET = QwtTest2
    18. TEMPLATE = app
    19.  
    20.  
    21. SOURCES += main.cpp
    22.  
    23. HEADERS +=
    24.  
    25. FORMS +=
    To copy to clipboard, switch view to plain text mode 

    And here is the main.cpp (some code I took as example from some of the threads in here)
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_plot.h>
    3. #include <qwt_plot_curve.h>
    4. #include <qwt_plot_grid.h>
    5. #include <qwt_symbol.h>
    6. #include <qwt_legend.h>
    7.  
    8. int main( int argc, char **argv )
    9. {
    10. QApplication a( argc, argv );
    11.  
    12. QwtPlot plot;
    13. plot.setTitle( "Plot Demo" );
    14. plot.setCanvasBackground( Qt::white );
    15. plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
    16. plot.insertLegend( new QwtLegend() );
    17.  
    18. QwtPlotGrid *grid = new QwtPlotGrid();
    19. grid->attach( &plot );
    20.  
    21. QwtPlotCurve *curve = new QwtPlotCurve();
    22. curve->setTitle( "Some Points" );
    23. curve->setPen( Qt::blue, 4 ),
    24. curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    25.  
    26. QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
    27. QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
    28. curve->setSymbol( symbol );
    29.  
    30. QPolygonF points;
    31. points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
    32. << QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
    33. << QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
    34. curve->setSamples( points );
    35.  
    36. curve->attach( &plot );
    37.  
    38. plot.resize( 600, 400 );
    39. plot.show();
    40.  
    41. return a.exec();
    42. }
    To copy to clipboard, switch view to plain text mode 

    It compiles without error, but when I run it it shows this in Application Output:
    QWidget: Must construct a QApplication before a QWidget
    ANy ideas how can I get it to work?
    Last edited by r2com; 9th August 2016 at 22:50.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Installing (or using?) Qwt without compiling the Qt Creator

    Quote Originally Posted by r2com View Post
    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.

    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

  3. #3
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default 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:
    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:
    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?
    Last edited by r2com; 10th August 2016 at 18:57.

  4. #4
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default 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:
    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:

    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?
    Last edited by r2com; 10th August 2016 at 22:07.

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Installing (or using?) Qwt without compiling the Qt Creator

    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.

    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 ?

    ${QWT_ROOT}
    Of course you have to use the real directory, QWT_ROOT is only a placeholder.

    Uwe

  6. #6
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default 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?

  7. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  8. #8
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default 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?

  9. #9
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default 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

Similar Threads

  1. installing QT creator 5
    By crisHerald in forum Newbie
    Replies: 14
    Last Post: 24th May 2013, 02:30
  2. Problems installing Qt Creator 5 and Qt 4
    By u04245822 in forum Qt Tools
    Replies: 0
    Last Post: 22nd April 2013, 10:10
  3. Replies: 1
    Last Post: 17th October 2011, 09:53
  4. Installing FANN lib in Qt creator!
    By Abeer in forum Newbie
    Replies: 6
    Last Post: 10th July 2011, 08:51
  5. Matplotlib widget installing on Qt Creator
    By soulz9 in forum Newbie
    Replies: 0
    Last Post: 15th April 2010, 06:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.