Results 1 to 9 of 9

Thread: QWT examples in Visual Studio 2005

  1. #1
    Join Date
    Aug 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default QWT examples in Visual Studio 2005

    Good day.

    If anybody has succesfully implemented the QWT examples in visual studio, i would greatly appreciate it if you can assist me on how to add the example files in Visual studio.

    I have installed Qt4.5 with the visual studio plug-in and Qwt5.2 succesfully. I am now trying to build a example in visual studio.

    Any help would greatly be appreciated

    Kind Regards

  2. #2
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    i managed to compile some of the examples in VS 2005.

    1. Create a new console app.
    2. copy the cpp and h files to your project dir.
    3. add the cpp and h files to your VC project
    4. go to project propreties -> linker -> input and add this line QtGui4.lib QtCore4.lib qwt5.lib
    5. if any class has Q_OBJECT defined make sure to make the MOC file and add it to you project

    i think that's all. good luck

  3. #3
    Join Date
    Aug 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    Hi.
    Thanx again emrares.

    Do you have any idea how to do this while creating a Makefile project in Visual Studio? Im doing a project that requires QT buttons to activate QWT plots. Thus the reason for doing Makefile projects.

    I don't know where to add the *.lib files and get a lot of linking errors. If anybody else knows as well I would appreciate it

    Thanx for the help

  4. #4
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    this should help you to get rid of the linking errors. you don't need QtSvg4.lib

    Do you have any idea how to do this while creating a Makefile project in Visual Studio
    i have no ideea
    Attached Images Attached Images

  5. #5
    Join Date
    Aug 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    Thanx again.

    I added the libraries where you told me. However, in win32 console project, Visual studio can't find the QT headers anymore. It still works fine in my QT applications, but not with the win32 console application.

    I started with the simple plot example of QWT and added the "simple.c" file in visual studio.
    If you can think what my problem is, please let me know. Else I will keep on searching.

    The last thing I want to ask:
    If I use an example that uses QOBJECT in the claas. How do I create the MOC file and where do I add it in my project? (Header,Resource, Source?)

    Thanx emrares. You have already helped me very much!
    Last edited by Roelof; 13th August 2009 at 15:22.

  6. #6
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    I will post the answer, and some screenshots tomorow morning when i get to work. You need to make some settings to VS that I cannot remember right now.

    just wanted to let you know that i saw your post, and i will help you

  7. #7
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    Visual studio can't find the QT headers anymore
    go to Visual Studio Options-> Projects and Solutions -> VC++ Directories

    you should see there "Show Directories for" combo-box. Select from the combo box Include files and in the list box add the path of your Qwt installation directory ( the directory that has the header files). for example "D:\ProgUtil\qwt-5.2.0\src"

    you should add there the path to the Qt directory too. (take a look at the files attached to this post)

    Next select from the combo box "Library files" and add to the list the path for the lib directory.

    How do I create the MOC file and where do I add it in my project
    If you take a look in the Qt directory (c:\Qt\2009.03\qt\bin\) you should see there a file moc.exe That's the file that will generate the moc files.

    To use it, go to your VC project directory and create a new directory "moc_files" in the directory create a new file (with notepad) and name it "MakeMOC.bat" in the file type this

    @echo off

    C:\Qt\2009.03\qt\bin\moc -o moc_MYFILE.cpp ..\MYFILE.h

    you will replace "C:\Qt\2009.03\qt\bin" with the path of your Qt installation directory and MYFILE with your filename.

    save the MakeMOC.bat file and when you will execute it it will generate a moc_file. Remember only generate moc files for the header files that have Q_OBJECT defined.

    How do you attach the moc files to your VC++ project?

    open your project, right click your project name Add -> New Filter give a name to your filter for example moc_files and next right click the moc_files filter Add -> Existing Item and add your moc_files to your project.

    That's all. Remember that when you add a new signal or slot to a header file you should recreate your moc file. Go to the moc_files directory and execute MakeMOC.
    Attached Images Attached Images

  8. #8
    Join Date
    Aug 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    Thanx Emrares!

    Me and a lot of people working above me... is very thankfull for your help. I did it all and it works good!

    I found another way of executing the QWT example files in visual studio. This approach is hard if you want to really alter the example, but gives a good starting point for qwt in visual studio for those interested.

    1. Open command line prompt. Set up the visual studio environment. This can be done by running "vcvars32.bat" located in my case in "Program files\Microsoft Visual Studio 8\VC\bin. Change directory to this path and type vcvars32.bat. This sets up the visual studio environment

    2. Change directory to the qwt example you want to use. In my case: "cd c:\qwt-5.2.0\examples\simple_plot

    3. type the following: "qmake -tp vc simple_plot.pro"
    This creates a visual studio project file.
    You can open this "simple.vcproj" file directly in visual studio and it will compile and build.

  9. #9
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWT examples in Visual Studio 2005

    Thanks for the tip. didn't know that

Similar Threads

  1. Replies: 7
    Last Post: 16th November 2009, 15:40
  2. qwt and visual studio 2005
    By stefan in forum Qwt
    Replies: 4
    Last Post: 30th September 2008, 11:25
  3. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  4. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  5. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

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.