Results 1 to 4 of 4

Thread: Add Qwt 5.2.2 to Qt Creator project in Windows 7

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Add Qwt 5.2.2 to Qt Creator project in Windows 7

    Hello!

    I'm trying now to compile in Windows a software I created in Linux that uses Qwt. In Linux, everything that I had to do to use qwt was to download it in the Synaptic and add to the .pro file:

    Qt Code:
    1. LIBS += -L/usr/local/lib -lqwt-qt4
    2. LIBS += -L/usr/local/lib -lQtSvg
    To copy to clipboard, switch view to plain text mode 

    and in the header where I create the Qwt objects:

    Qt Code:
    1. #include <qwt-qt4/qwt_plot.h>
    2. #include <qwt-qt4/qwt_plot_curve.h>
    3. #include <qwt-qt4/qwt_plot_grid.h>
    4. #include <qwt-qt4/qwt_plot_canvas.h>
    To copy to clipboard, switch view to plain text mode 

    Now that I'm in Windows, though, I simply don't know what to do. I searched a lot of guides in the net and none of the worked. I now essentially that I had to compile the qwt having changed the qwtconfig.pri before (as http://johnhforrest.com/2010/09/inst...wt-on-windows/ indicated) and now I need to add qwt as an external library in the .pro file.

    But I simply don't know the code to add; everything I try leads to the same error: the headers are not found. All things I tried:

    Qt Code:
    1. include(C:\QtSDK\qwt-5.2.2\qwtconfig.pri)
    2. LIBS += -L/C:/QtSDK/qwt-5.2.2/ -lqwt-qt4
    3. LIBS += -LC:\QtSDK\qwt-5.2.2\lib -lqwt5.dll
    4. LIBS += -LC:\QtSDK\qwt-5.2.2 -lQtSvg
    5. INCLUDEPATH += C:\QtSDK\qwt-5.2.2\include
    6.  
    7. LIBS += C:\QtSDK\qwt-5.2.2\lib\qwt5d.dll
    8. LIBS += -LC:\QtSDK\qwt-5.2.2 -lqwt
    To copy to clipboard, switch view to plain text mode 

    Note: not all of them together.

    ... but none worked. So what need I to do?

    One interesting thing that I noticed was the the compile of qwt before adding it to the project did not create any .lib file, and the .dll files sims useless.


    Could somebody help, please?

    Thanks!

    Momergil

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Add Qwt 5.2.2 to Qt Creator project in Windows 7

    Compiler can't find your headers because it searches for them in <INCLUDEPATH>/qwt-qt4 directory which doesn't exist (also qwt-5.2.2\include doesn't exists either unless you've changed something).

    In your *.pro file add:
    Qt Code:
    1. win32:INCLUDEPATH += C:\QtSDK\qwt-5.2.2
    To copy to clipboard, switch view to plain text mode 
    and rename the src directory inside C:\QtSDK\qwt-5.2.2 to qwt-qt4, then compiler should be able to find header files.
    This way you won't have to modify your source files and it should compile on linux as well as on windows.

    You'll also need an os specific library statements in the pro file, something like that:
    Qt Code:
    1. win32 {
    2. LIBS += -LC:\QtSDK\qwt-5.2.2\lib -lqwt5 (that's release version qwtd5 is debug)
    3. }
    4. unix {
    5. LIBS += -L/usr/local/lib -lqwt-qt4
    6. LIBS += -L/usr/local/lib -lQtSvg
    7. }
    To copy to clipboard, switch view to plain text mode 
    you should also add per os release/debug handling in the pro file.

    Your final *.pro file should have something like that:
    Qt Code:
    1. win32 {
    2. INCLUDEPATH += C:\QtSDK\qwt-5.2.2
    3.  
    4. CONFIG(debug, debug|release) {
    5. LIBS += -LC:\QtSDK\lib -lqwtd5
    6. }
    7. else {
    8. LIBS += -LC:\QtSDK\lib -lqwt5
    9. }
    10. }
    11.  
    12. unix {
    13. LIBS += -L/usr/local/lib -lqwt-qt4
    14. LIBS += -L/usr/local/lib -lQtSvg
    15. }
    To copy to clipboard, switch view to plain text mode 
    and remember to rename qwt's src directory to avoid messing with your source files.

  3. #3
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Add Qwt 5.2.2 to Qt Creator project in Windows 7

    Installing Qwt with "make install" brings qmake configuration file to your system (see end of INSTALL file from Qwt). So, you can simply do such magic in your project file:
    Qt Code:
    1. CONFIG += qwt
    To copy to clipboard, switch view to plain text mode 

    It's useful when you build project in different environments.
    Oleg Shparber

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Add Qwt 5.2.2 to Qt Creator project in Windows 7

    Quote Originally Posted by Oleg View Post
    So, you can simply do such magic in your project file:
    Qt Code:
    1. CONFIG += qwt
    To copy to clipboard, switch view to plain text mode 
    For Qwt 6.x - but not for Qwt 5.x !

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    alizadeh91 (6th October 2012)

Similar Threads

  1. Replies: 2
    Last Post: 10th February 2011, 17:03
  2. Build two programs in one project in creator
    By Gunnar in forum Qt Tools
    Replies: 1
    Last Post: 13th October 2010, 09:52
  3. Duplicate a Qt Creator project
    By Coises in forum Newbie
    Replies: 5
    Last Post: 20th December 2009, 20:38
  4. HELP!!!Qt Creator can not open project file
    By zhouxf in forum Qt Tools
    Replies: 7
    Last Post: 22nd May 2009, 10:56
  5. Qt Creator project view
    By JohnToddSr in forum Qt Tools
    Replies: 3
    Last Post: 4th May 2009, 08:48

Tags for this Thread

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.