[Help] How to set up the Qt include\Library path for Visual Studio 2010



  • Hi guys,

    I am pretty new to QT, I am wondering any1 here can get Qt SDK compiled by using Visual Studio 2010 express (VS2010Exp)?
    This what I did:

    • I downloaded the SDK package, installed it.

    • Create a new empty project in VS2010Exp and a cpp file including simple code.

    • Set up the include files path: added c:\Qt\2010.5.10\qt\Include and c:\Qt\2010.5.10\qt\Include

    • Set up the Library files path: added c:\Qt\2010.5.10\qt\Bin and c:\Qt\2010.5.10\qt\Bin. I also tried to add "c:\Qt\2010.5.10\qt\lib" and "c:\Qt\2010.5.10\lib".

    After that, I tried to compile the project, but I got LINK error which says that the compiler cant find Qt function definitions. As far as I see, the problem is the Library file including.

    So my question is how can I correctly set up the including files (Include/Library) path?



  • [quote author="kusanagirong" date="1285794026"]Hi guys,

    • Set up the Library files path: added c:\Qt\2010.5.10\qt\Bin and c:\Qt\2010.5.10\qt\Bin
      [/quote]

    I guess the lib path should be something like c:\Qt\2010.5.10\qt\lib - I don't have a Windows setup to confirm it right now, but the path probably looks like that.



  • First of all I would suggest you to use QtCreator. It makes all things with Qt pretty easy. (AFAIK it is included in the SDK)

    Did you create a new c++ project in Visual Studio?
    If you did so Qt requires .pro files "as explained here":http://doc.qt.nokia.com/4.7/qmake-project-files.html . You can then use qmake with parameter -tp vc to create a Visual Studio project. This has all required qt Libraries added aswell as all of the other stuff you wrote in your .pro file.



  • anselmolsm wrote:
    I guess the lib path should be something like c:\Qt\2010.5.10\qt\lib – I don’t have a Windows setup to confirm it right now, but the path probably looks like that.

    Sorry, I forgot to mention that I also tried include " c:\Qt\2010.5.10\qt\lib" and "c:\Qt\2010.5.10\lib" too, but it still does work :p



  • Hi Felix,

    Thanks for your reply, I will try it later. But according to your suggestion I got another question about creator. Is it a IDE just for Qt or I can easily use any other API in it? And is it got a nice debug tools like VS 2010 exp. Since I am trying to add a GUI to an OpenGL application. I am not sure the creator is handy or not for this task.

    Cheers!



  • Don't use creator if you have Visual studio. Visual studio is a much more powerful tool than creator. An easy way to setup include paths and library paths is to install the Qt visual studio add in.

    "Visual studio add in.":http://qt.nokia.com/downloads/visual-studio-add-in

    Plus, hard coding those paths isn't such a good idea other. Look into setting up system variables. I use QTDIR. Then all you have to do in visual studio is $(QTDIR)\lib and $(QTDIR)\include.



  • Thanks for your reply steno. I think VS is cool :)


  • Moderators

    If it is a LINK error then it definitely is not about include pathes since the linked does not care at all about header files.

    Check the library include pathes instead.



  • I want to ask kusanagirong: if u compiled properly

    1). open command prompt from VS2010
    2). Run configure.exe after changing to QT sdk dir
    3). after successful configure run "nmake -f"

    it will create the libraries for VS2010 compatible and debug files. it also convert your Qt Examples and demo projects to VS project.

    this process is very lengthy and takes hours to compile.
    but u can compile project from QtCreator only by setting Qt Qmake path.
    as qt plugin cannot be installed on a VS2010 Exp edition.

    there is custom compilation of Qt project in VS (like MOC, UIC etc.) which requires Qt plugin, only possible in VS pro/team/ultimate etc not in Express ed.


  • Moderators

    kusanagirong: Give Qt Creator a try:-) I absolutely prefer it to visual studio ...



  • [quote author="Tobias Hunger" date="1285928770"]kusanagirong: Give Qt Creator a try:-) I absolutely prefer it to visual studio ...[/quote]

    ditto :)



  • i also think its best for qt applications



  • bq. Tobias Hunger wrote:
    kusanagirong: Give Qt Creator a try:-) I absolutely prefer it to visual studio …

    Lol, you're a troll..... you get paid to say that.


  • Moderators

    steno: No, I am payed to hack on the most awesome IDE there is:-)



  • Well im Not a Troll but creator is Best for qt in my opinion



  • yeah, QT is fast, easy and handy only u've to remember its short keys. and most impotant it is not bloated like vs.

    in case of compilation of code MS compiler is fast (also generate the debug info, means if error occurs it through an exception message not in case of mingw. it just close app).


  • Moderators

    pushpendrak: You are aware that you can use the msvc compiler and cdb debugger with creator?



  • yes i am using it also. it works fine -but is not much helpful. if app crashes it let me know what was the error okey.....


  • Moderators

    pushpendrak: Do you want the debugger to be brought up when an application crashes automatically? That is called "post-mortem debugging" and can be enabled in creator. By default it is off since many people report they find it annoying.



  • yes it is there, but when i m app is coming into creator it shows only assembly, what i'll do with that?
    not of any use.

    like as in vs it produces program database (.pdb) which will trace it to exact line in code.


  • Moderators

    As far as I know that should work with creator, too. Have you considered to file a "bug report":http://bugreports.qt.nokia.com/?



  • Not actually, for this i use vs2008 integration with Qt.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.