Results 1 to 19 of 19

Thread: How to include qrc resource file in Visual Studio 2005?

  1. #1
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to include qrc resource file in Visual Studio 2005?

    Hello everyone,

    I used Eclipse with Qt, and I have not any problems about using qrc resource file. Now I am using Qt with Visual Studio 2005, and I don't know how to implement my resource file. Resource file is good, it works in eclipse. Visual Studio use *.rc files for resources, and can not recognize *.qrc. Is there any other way to display picture in Qt (not to use resource files)?

    Thanks a lot!

  2. #2
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    I forgot to mention that I'm using Qt open source version (4.3.3) and I haven't in Visual Studio make new Qt project and nothing related to Qt, so I can't simply add a qrc resource file. My Qt application work fine.

    Thanks

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Well, the open source edition has no Visual Studio integration so you will have to handle the resource file as an ordinary XML file. Luckily the syntax of Qt resource file is very simple.
    J-P Nurmi

  4. #4
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Instead of editing manually, you can also edit qrc files from designer.

  5. #5
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Hi, thanks for yours reply,

    I already have proper qrc file. How I can import xml file? Do I have to simply change extension of my *.qrc file into *.xml. When I go to Add resource there is only html format. Qt designer accepts only *.qrc files.

    Thanks!

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Sorry for being unclear. What I meant was that you can edit it like any other XML file. But indeed, Qt Designer is much better choice for handling .qrc files.
    J-P Nurmi

  7. #7
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    I know how to make *.qrc files, I don't know how to tell Visual Studio that *.qrc is a resource file. Visual Studio don't know what is qrc extension, and I can't implement qrc file into my project. I used this project on Eclipse and this work just fine, pictures are showed up, but I had to use Visual Studio, and now my pictures wouldn't shows up. Resource file is same in both platforms (Visual and Eclipse).

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Do you have the resource file in your .pro file and did you generate the Visual Studio project with qmake?
    J-P Nurmi

  9. #9
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    I don't have .pro file. I had it in Eclipse, but no in Visual Studio. I have console application project in Visual Studio. I set up my project like this. That is a problem, because I don't have a .pro file.

  10. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Then perhaps you should start using one? Do you ever plan to build your project in any other environment than Visual Studio? Do you ever plan to let anyone else build that project? What if he doesn't have Visual Studio but is using GCC/MinGW/Eclipse/XCode/whatever he prefers?

    The great advantage with qmake .pro file is that it's cross-platform and independent of building environment. qmake supports lots of compilers on lots of platforms. Additionally, qmake is even able to generate a Visual Studio project file (.vcproj) for you. On the other hand, a Visual Studio project file is tied to Visual Studio. There's not much you can do with a Visual Studio project file on Linux with GCC.
    J-P Nurmi

  11. #11
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Reason why I'm using Visual Studio is that I couldn't include win32 libraries in .pro file.

  12. #12
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Quote Originally Posted by jambrek View Post
    Reason why I'm using Visual Studio is that I couldn't include win32 libraries in .pro file.
    Yes, you can. You should add something like this in your .pro file.
    Qt Code:
    1. TEMPLATE = app
    2. QT += network
    3.  
    4. ...
    5.  
    6. LIBS += NetApi32.lib Advapi32.lib
    7.  
    8. ...
    To copy to clipboard, switch view to plain text mode 

  13. #13
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    I added this:
    Qt Code:
    1. LIBS += -LD:/Darko/projects/PCapp -lFTCJTAG -lFTD2XX
    To copy to clipboard, switch view to plain text mode 
    But this recognize only *.a libraries. I found this way of loading libraries on the internet. -L is for folder, and -l is for file.

  14. #14
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    You should use docs as number one reference: qmake Variable Reference - LIBS
    J-P Nurmi

  15. #15
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Thanks a lot. Now I have to set up my environment for eclipse and mingw again.

  16. #16
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Quote Originally Posted by jambrek View Post
    Thanks a lot. Now I have to set up my environment for eclipse and mingw again.
    Perhaps if you stated the problem we were able to help you. bender86 already gave you the preferred way to link libraries with MSVC. Docs state the same. So what's the problem?
    J-P Nurmi

  17. #17
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    Now I saw that my post sounds little ironic, but I didn't meant like that. I truly want to thanks you.

  18. #18
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    I have a problem. I set up qt for eclipse+mingw, and use code from visual studio, and load libraries in this way. There is no compiler or linker errors, but when I try to start my program nothing will shows up. Program is automatically terminated. When I load old project (without libs) it's works just fine (in eclipse+mingw+qt). Any ideas?
    Thanks

  19. #19
    Join Date
    Oct 2007
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to include qrc resource file in Visual Studio 2005?

    My mistake, i had to copy some .dlls. Now it's works.

Similar Threads

  1. 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
  2. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22
  3. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  4. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  5. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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.