Results 1 to 9 of 9

Thread: How to Include Qwt in My Project

  1. #1
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to Include Qwt in My Project

    Hey Guys

    I have a project and I want to use qwt_text in it .
    So I installed qwt . Now I don't know how to include qwt_text in it

    I mean what are the neccessary changes that I have to make in my .pro file .

    I use ubuntu 10.10 , QtCreator 2.0.1 , Qt 4 , Qwt 5.2.1

    sry for dumb question

  2. #2
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to Include Qwt in My Project

    Hi gbmtoday,

    I am new to Qwt too. I am using the same os as yours. I may give you a help.

    Can you see the qwt widget in your qt creator? if you can jump to 3)

    1) need to copy some files
    $ cp /home/czhang/qtsdk-2010.04/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/qtsdk-2010.04/bin/designer
    $ sudo cp -a /home/czhang/qtsdk-2010.04/qwt-5.2.1/lib/* /usr/lib64

    2) run your qt creator, you will see qwt widgets in there.

    3) in your .pro file, you need to add:
    Qt Code:
    1. LIBS += -lqwt
    2. INCLUDEPATH += /home/czhang/qtsdk-2010.05/qwt-5.2.1/src
    To copy to clipboard, switch view to plain text mode 

    you may need to add the following lib at the end:
    Qt Code:
    1. LIBS += -L/usr/local/lib -lQtSvg
    To copy to clipboard, switch view to plain text mode 

    I wrote a note to help me to remember what I did. here is the link, i hope it will be helpful.
    http://studyard.blogspot.com/2010/10...t-problem.html
    Last edited by cooper; 3rd November 2010 at 21:11.

  3. The following user says thank you to cooper for this useful post:

    gbmtoday (5th November 2010)

  4. #3
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to Include Qwt in My Project

    Thanks Buddy
    Nice Blog by the way


    Added after 1 38 minutes:


    I installed QtCreator and Qt from ubuntu official repository so I don't have a folder named qtsdk-2010.04

    also when I try to make my project I face this error
    Qt Code:
    1. cannot find -lqwt
    To copy to clipboard, switch view to plain text mode 
    Last edited by gbmtoday; 5th November 2010 at 17:11.

  5. #4
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to Include Qwt in My Project

    I don't have a folder named qtsdk-2010.04
    it does not matter.
    it might install in different directory. you can use "find"
    cz@cz-laptop:~$ find /home/cz -name qtcreator
    /home/cz/qtsdk-2010.05/bin/qtcreator
    /home/cz/qtsdk-2010.05/lib/qtcreator
    /home/cz/qtsdk-2010.05/share/doc/qtcreator
    /home/cz/qtsdk-2010.05/share/qtcreator
    /home/cz/.config/Nokia/qtcreator

    you will see where the qt is installed. In my case, it installed in /home/cz/qtsdk-2010.05/

    cannot find -lqwt
    you need to give a path where you install the Qwt, eg:
    Qt Code:
    1. LIBS += -lqwt
    2. INCLUDEPATH += /home/cz/qtsdk-2010.05/qwt-5.2.1/src
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to cooper for this useful post:

    gbmtoday (13th November 2010)

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

    Default Re: How to Include Qwt in My Project

    1) Download qwt-5.2.1.tar.bz2
    2) tar xfj qwt-5.2.1.tar.bz2
    3) cd qwt-5.2.1
    4) qmake
    5) make
    6) su -c "make install" ( Boys, what's so hard about doing this ? )

    Now the designer plugin should be copied into the plugins/designer directory of your Qt install directory. All other files can be found in /usr/local/qwt-5.2.1.

    The following steps are Linux or Qt basics:

    7) The Qwt designer plugin ( or any application using Qwt ) needs to see the Qwt library. Read about ldconfig or LD_LIBRARY_PATH how to do so. Don't continue before "ldd <your qt directory>/plugins/designer/libqwt_designer_plugin.so" shows a valid path for libqwt.so.

    When using LD_LIBRARY_PATH note, that an environment variable is only valid for the process itsself and its child processes. Until you have understood what this means better start the designer/creator manually from the shell, where you have set LD_LIBRARY_PATH.

    8) Add the following to your application project file

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

    Uwe

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

    gbmtoday (13th November 2010)

  9. #6
    Join Date
    Mar 2010
    Location
    Brazil
    Posts
    39
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to Include Qwt in My Project

    Quote Originally Posted by gbmtoday View Post
    Thanks Buddy
    Nice Blog by the way


    Added after 1 38 minutes:


    I installed QtCreator and Qt from ubuntu official repository so I don't have a folder named qtsdk-2010.04

    also when I try to make my project I face this error
    Qt Code:
    1. cannot find -lqwt
    To copy to clipboard, switch view to plain text mode 
    Install this package too: libqwt5-qt4-dev
    When the install will be done. You will see the new Qwt widgets in QtCreator.

  10. The following user says thank you to HelderC for this useful post:

    gbmtoday (13th November 2010)

  11. #7
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: How to Include Qwt in My Project

    Well I've done all of this and I still cant build a simple qwt project in the qtcreator tool.
    I can build from the command line using the qmake and make. From the command line the application compiles fine and links to the /usr/local/qwt-5.2.1/lib/libqwt.so libs fine and produces an executable.
    From creator it doesn't seem to link with lqwt.
    The project source is the simple.cpp of the examples and the simple.pro file is as follows
    TARGET = simple

    SOURCES = \
    simple.cpp


    INCLUDEPATH += /usr/local/qwt-5.2.1/include
    LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt



    The /usr/lib/qtcreator/plugins dir contains the libqwtplugin.so lib
    and running ldd gives
    linux-gate.so.1 => (0x00911000)
    libqwt.so.5 => /usr/local/qwt-5.2.1/lib/libqwt.so.5 (0x00e1d000)
    ...

    The creator compiler output is as follows
    Running build steps for project simple_plot...
    Configuration unchanged, skipping qmake step.
    Starting: "/usr/bin/make" -w
    make: Entering directory `/home/ps/Downloads/qwt521/qwt-5.2.1/examples/simple_plot-build-desktop'
    g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/home/ps/qttest/PlotExamples/Plot -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/local/qwt-5.2.1/include -I. -I/home/ps/qttest/PlotExamples/Plot -I. -o simple.o /home/ps/qttest/PlotExamples/Plot/simple.cpp
    g++ -o simple simple.o -L/usr/lib -L/usr/local/qwt-5.2.1/lib -lqwt -lQtGui -lQtCore -lpthread
    simple.o: In function `Plot':
    /home/ps/qttest/PlotExamples/Plot/simple.cpp:64: undefined reference to `QwtPlot::QwtPlot(QWidget*)'

    plus a about 100 other undefined references to the qwt methods


    Thanks in advance for any help

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

    Default Re: How to Include Qwt in My Project

    Quote Originally Posted by imnewtoqt View Post
    I can build from the command line using the qmake and make. From the command line the application compiles fine and links to the /usr/local/qwt-5.2.1/lib/libqwt.so libs fine and produces an executable.

    From creator it doesn't seem to link with lqwt.

    g++ -o simple simple.o -L/usr/lib -L/usr/local/qwt-5.2.1/lib -lqwt -lQtGui -lQtCore -lpthread
    Simply compare the compiler/linker commands with the successful ones you get from qmake on the console.

    Maybe disable the Shadow Build option in the Creator, so that the compile/linker commands are closer to your other build.

    Uwe

  13. #9
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Include Qwt in My Project

    Quote Originally Posted by Uwe View Post
    Simply compare the compiler/linker commands with the successful ones you get from qmake on the console.

    Maybe disable the Shadow Build option in the Creator, so that the compile/linker commands are closer to your other build.

    Uwe
    OK thanks very good idea.
    The result is painful and bizzar :
    g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I/usr/local/qwt-5.2.1/include -I/usr/include/qt3 -o simple.o simple.cpp
    g++ -o simple simple.o -L/usr/share/qt3/lib -L/usr/X11R6/lib -L/usr/local/qwt-5.2.1/lib -lqwt -lqt-mt -lXext -lX11 -lm -lpthread
    So it seems that on the command line I'm linking against qt3. This can't be good.
    I think i'll uninstall and reinstall everything I can.
    Thanks again


    Added after 1 35 minutes:


    Thankyou Uwe
    uninstalling the qt3 dev tools and reinstall the qt4 dev tools and reinstalling qwt521
    seems to have fixed everything. And it only took 1 hour 35 min to do and test.
    Last edited by imnewtoqt; 3rd February 2011 at 01:13.

Similar Threads

  1. How to tell Qmake to include ws2_32 in visual studio project
    By umen in forum Installation and Deployment
    Replies: 0
    Last Post: 25th October 2010, 07:28
  2. Replies: 1
    Last Post: 3rd December 2009, 23:34
  3. How to include existing files to project?
    By Asperamanca in forum Qt Tools
    Replies: 2
    Last Post: 14th November 2009, 20:50
  4. mfc in QT include
    By trusch in forum Qt Programming
    Replies: 3
    Last Post: 16th July 2009, 10:01
  5. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43

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.