[SOLVED] MSVC 2012 cannot autodetect include paths
-
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.
-
Hi,
Are you using Visual Studio directly or Qt Creator ?
-
Are you sure you have all include path setup correctly in your pro file ?
-
[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 = subdirsSUBDIRS += StaticLibrary1
StaticLibrary2
MainAppCONFIG += 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.
-
Do you have something like
@INCLUDEPATH += $$PWD/../StaticLibrary1/include@
in your MainApp pro file ?
-
[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).
-
Then do you have
@INCLUDEPATH += .@
In your application pro file ?
-
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 :)