Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] MSVC 2012 cannot autodetect include paths
QtWS25 Last Chance

[SOLVED] MSVC 2012 cannot autodetect include paths

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 2 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    panosk
    wrote on last edited by
    #1

    Hi,

    I mostly use clang (occasionally also gcc) both on OS X and Linux, and also tried mingw on Windows. I wanted to try msvc on Windows because I find mingw slow, but it seems that with msvc I must be more explicit with my includes. For example, both with clang and gcc this is fine:
    @
    #include "myheader.h"
    @

    With msvc I have to change it to something like this:
    @
    #include "../myheader.h"
    @

    Is this a known peculiarity? I tried this on Windows 7 64bit, Qt 5.1.1, MSVC2012.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you using Visual Studio directly or Qt Creator ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        panosk
        wrote on last edited by
        #3

        [quote author="SGaist" date="1386331739"]Hi,

        Are you using Visual Studio directly or Qt Creator ?[/quote]

        Hi,

        I'm using Qt Creator 2.8.1 (based on Qt 5.1.1, MSVC 2010, 32bit).

        1 Reply Last reply
        0
        • P Offline
          P Offline
          panosk
          wrote on last edited by
          #4

          I also forgot to mention that while I'm typing the include, Qt Creator correctly finds the header and autocompletes it. The problem appears during compilation with a "file not found" error.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Are you sure you have all include path setup correctly in your pro file ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • P Offline
              P Offline
              panosk
              wrote on last edited by
              #6

              [quote author="SGaist" date="1386459844"]Are you sure you have all include path setup correctly in your pro file ?[/quote]

              I guess paths are fine, otherwise the project wouldn't compile properly with the other compilers. FWIW, it's a subdirs projects, with no .pri files (yet). My main .pro file looks like this:
              @
              TEMPLATE = subdirs

              SUBDIRS += StaticLibrary1
              StaticLibrary2
              MainApp

              CONFIG += ordered
              @

              and in the MainApp project some files are organized into folders. Before removing it, mingw could also find all includes and compile the project just fine with this setup.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Do you have something like

                @INCLUDEPATH += $$PWD/../StaticLibrary1/include@

                in your MainApp pro file ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  panosk
                  wrote on last edited by
                  #8

                  [quote author="SGaist" date="1386536019"]Do you have something like

                  @INCLUDEPATH += $$PWD/../StaticLibrary1/include@

                  in your MainApp pro file ?[/quote]

                  Yes, MainApp.pro contains both the INCLUDEPATH and the DEPENDPATH for both libraries.

                  Actually, the headers that can't be found during compilation are all from MainApp -- the libraries do not have any folder hierarchy (each library's files are placed in a single folder).

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Then do you have

                    @INCLUDEPATH += .@

                    In your application pro file ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      panosk
                      wrote on last edited by
                      #10

                      No, but I added it and now the compiler seems happy. Why is that needed only with MSVC?

                      Thanks for your help SGalst :)

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        That's a good question… Can you compare the Makefiles generated for both compilers without the "INCLUDEPATH += ." ?

                        Check whether the MinGW version has an additional include path corresponding to your application folder

                        You're welcome :)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved