Results 1 to 4 of 4

Thread: Qt with Visual Studio 2005

  1. #1
    Join Date
    Jun 2012
    Posts
    58
    Qt products
    Qt4
    Thanks
    13

    Default Qt with Visual Studio 2005

    hi, (this question may be more about Visual Studio but as i'm using it in conjunction with Qt and a few other posts contain questions on Visual Studio also, i took the liberty of posting this here)
    i've the following in the custom build property of every header file that uses Q_OBJECT:
    Qt Code:
    1. Command Line: $(THIRDPARTY_DIR)\qt\4.7.0\win32-vc10\bin\moc.exe $(InputFileName) -o moc\$(ConfigurationName)\moc_$(InputName).cpp
    2. Description: ################### moc'ing $(InputFileName)
    3. Outputs: moc\$(ConfigurationName)\moc_$(InputName).cpp
    To copy to clipboard, switch view to plain text mode 
    This generates the necessary moc files. I now want to ask visual studio to compile and link these too to my other source files. Presently i'm using
    Qt Code:
    1. #include "moc\{Release OR Debug}\moc_Whatever.cpp"
    To copy to clipboard, switch view to plain text mode 
    these statements in any of the files to force compilation and linking. Evidently i have to keep changing my #include according to debug or release build (i cannot discard $(ConfiguarationName) during moc file generation above for reasons). Plus i dont like the idea of writing this #include in the source files just for the purposes of compilation and linking.

    Is there any build step in properties anywhere where i can mention what files will be generated in future and to compile and link them when they are available (VS2005)?

    (i cannot use QtPlugin right now)

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 284 Times in 279 Posts

    Default Re: Qt with Visual Studio 2005

    First don't include moc files to source files. Add them to project.
    Second download and install Qt VS Addin and create project from scratch.

  3. #3
    Join Date
    Jun 2012
    Posts
    58
    Qt products
    Qt4
    Thanks
    13

    Default Re: Qt with Visual Studio 2005

    To add them to the project they must exist. This is what Visual Studio seems to check. I did the following: Project > add > new filter then Added a moc file from previously generated build. When i did clean (which deleted the moc file) and tried rebuilding the project it complained about the file not being present. how do i specify that it should look for it only after all the custom builds have been executed?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 284 Times in 279 Posts

    Default Re: Qt with Visual Studio 2005

    Qt VS Addin do this work for You. It is full automated.

Similar Threads

  1. qwt and visual studio 2005
    By stefan in forum Qwt
    Replies: 4
    Last Post: 30th September 2008, 12:25
  2. Using QT in Visual Studio 2005
    By mittalpa in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 18:19
  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, 07:51
  4. QT - Visual Studio 2005
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 08:20
  5. Qt 4.1.0 on Visual Studio 2005
    By nErnie in forum Installation and Deployment
    Replies: 8
    Last Post: 6th July 2006, 01:56

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
  •  
Qt is a trademark of The Qt Company.