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. QtCreator reports lots of headers as "not found"
Forum Updated to NodeBB v4.3 + New Features

QtCreator reports lots of headers as "not found"

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
24 Posts 5 Posters 9.7k Views 1 Watching
  • 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.
  • bleriot13B Offline
    bleriot13B Offline
    bleriot13
    wrote on last edited by bleriot13
    #13

    Hi once more.

    I'm on the verge of desperation.

    Following a mix of the advice given by all of you I have gone through the steps below:

    • Updated MSVC using the MSVC installer.
    • Uninstalled Qt completely.
    • Deleted the Qt settings in %appdata%\QtProject and %localappdata%\QtProject (not the contents of these folders but the folders themselves, so no trace of settings remained).
    • Removed all temporary files using Bleachbit.
    • Cleaned the registry using Glarysoft Registry Cleaner.
    • Restarted the computer.
    • Installed Qt from scratch.

    The problem persists.

    If I show the paths used by Qt using Tools -> Debug Qt Creator -> Inspect C++ Code Model I get the following:

    paths.png

    The red rectangle points to the paths that seem to indicate include directories. There, there's no trace of the actual path where one of the missing header files (math.h, for instance) is located:

    C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt

    a folder which is the same as the one given by cristian-adam.

    My last hope is to UNINSTALL everything (MSVC, Qt) and start again. This is what I'm going to do right now. If this doesn't work, I don't know what else can I do.

    1 Reply Last reply
    0
    • cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote on last edited by
      #14

      Big uff @bleriot13 ! It shouldn't be that hard to get a working MSVC installation.

      Alternatively you could try a different way of installing Visual Studio, via a package manager (Chocolatey):

      $ choco install visualstudio2022buildtools
      $ choco install windows-sdk-11-version-22H2-all
      

      Then at the end I start the "Visual Studio Installer" from start menu and selected "Desktop Development with C++".

      I only need Visual Studio BuildTools and not Community.

      1 Reply Last reply
      0
      • bleriot13B Offline
        bleriot13B Offline
        bleriot13
        wrote on last edited by
        #15

        No joy.

        This time I have uninstalled everything, cleaned preferences, registry and temporary files.

        The result is exactly the same. However, there's something I have noticed that is related to the MSVC compiler.

        If you open an "x64 Native Tools Command Prompt" using the MSVC 2022 entry in Windows Start menu, the vcvars64.bat batch file is automatically executed. Therefore, issuing the "SET" command lists the environment variables set in such a way that the compiler (cl.exe) may work properly.

        Well, just after installing MSCV 2022 from scratch and before installing Qt, I opened the said command prompt and typed "set". The result is shown below:

        ALLUSERSPROFILE=C:\ProgramData
        APPDATA=C:\Users\cttc\AppData\Roaming
        CommandPromptType=Native
        CommonProgramFiles=C:\Program Files\Common Files
        CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
        CommonProgramW6432=C:\Program Files\Common Files
        COMPUTERNAME=LTJANAVARRO
        ComSpec=C:\WINDOWS\system32\cmd.exe
        DevEnvDir=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\
        DriverData=C:\Windows\System32\Drivers\DriverData
        EFC_4820=1
        ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
        EXTERNAL_INCLUDE=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include
        Framework40Version=v4.0
        FrameworkDir=C:\Windows\Microsoft.NET\Framework64\
        FrameworkDir64=C:\Windows\Microsoft.NET\Framework64\
        FrameworkVersion=v4.0.30319
        FrameworkVersion64=v4.0.30319
        GDAL_DATA=C:\Program Files\PostgreSQL\13\gdal-data
        GEOSERVER_DATA_DIR=C:\ProgramData\GeoServer
        GEOSERVER_HOME=C:\Program Files\GeoServer
        HOMEDRIVE=C:
        HOMEPATH=\Users\cttc
        INCLUDE=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include
        JAVA_HOME=C:\Program Files\Java\jdk-11
        LIB=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64
        LIBPATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x86\store\references;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
        LOCALAPPDATA=C:\Users\cttc\AppData\Local
        LOGONSERVER=\\LTJANAVARRO
        NUMBER_OF_PROCESSORS=8
        OneDrive=C:\Users\cttc\OneDrive - Centre Tecnol•gic de Telecomunicacions de Catalunya
        OneDriveCommercial=C:\Users\cttc\OneDrive - Centre Tecnol•gic de Telecomunicacions de Catalunya
        OPENCV_DIR=C:\Users\cttc\ODjnavarro\jnavarro\Dev2\opensource_libraries\opencv3
        OS=Windows_NT
        Path=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\VCPackages;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\bin\Roslyn;C:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools;C:\Program Files\Microsoft Visual Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\;C:\Users\cttc\ODjnavarro\jnavarro\Dev2\ADAtools\installer\deployment\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\Users\cttc\AppData\Local\Microsoft\WindowsApps;C:\Users\cttc\AppData\Local\Programs\MiKTeX\miktex\bin\x64\;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg
        PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
        PGPASSFILE=%APPDATA%\postgresql\pgpass.conf
        Platform=x64
        POSTGIS_ENABLE_OUTDB_RASTERS=1
        POSTGIS_GDAL_ENABLED_DRIVERS=GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid
        PROCESSOR_ARCHITECTURE=AMD64
        PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
        PROCESSOR_LEVEL=6
        PROCESSOR_REVISION=8e0c
        ProgramData=C:\ProgramData
        ProgramFiles=C:\Program Files
        ProgramFiles(x86)=C:\Program Files (x86)
        ProgramW6432=C:\Program Files
        PROJ_LIB=C:\Program Files\PostgreSQL\13\share\contrib\postgis-3.1\proj
        PROMPT=$P$G
        PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
        PUBLIC=C:\Users\Public
        PYTHONPATH=C:\Users\cttc\jnavarro\Dev2\python
        SESSIONNAME=Console
        SystemDrive=C:
        SystemRoot=C:\WINDOWS
        TEMP=C:\Users\cttc\AppData\Local\Temp
        TMP=C:\Users\cttc\AppData\Local\Temp
        USERDOMAIN=LTJANAVARRO
        USERDOMAIN_ROAMINGPROFILE=LTJANAVARRO
        USERNAME=janavarro
        USERPROFILE=C:\Users\cttc
        VCIDEInstallDir=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\
        VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\
        VCPKG_ROOT=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg
        VCToolsInstallDir=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\
        VCToolsRedistDir=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.36.32532\
        VCToolsVersion=14.36.32532
        VisualStudioVersion=17.0
        VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
        VS170COMNTOOLS=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\
        VSCMD_ARG_app_plat=Desktop
        VSCMD_ARG_HOST_ARCH=x64
        VSCMD_ARG_TGT_ARCH=x64
        VSCMD_VER=17.6.0
        VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\
        windir=C:\WINDOWS
        WindowsLibPath=References\CommonConfiguration\Neutral
        WindowsSDKLibVersion=winv6.3\
        WindowsSDKVersion=\
        ZES_ENABLE_SYSMAN=1
        __DOTNET_ADD_64BIT=1
        __DOTNET_PREFERRED_BITNESS=64
        __VSCMD_PREINIT_PATH=C:\Users\cttc\ODjnavarro\jnavarro\Dev2\ADAtools\installer\deployment\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\Users\cttc\AppData\Local\Microsoft\WindowsApps;C:\Users\cttc\AppData\Local\Programs\MiKTeX\miktex\bin\x64\
        
        

        If you take a look to the INCLUDE variable, you'll see that its contents is exactly the same that I presented in screenshot showing the "C++ Code Model Inspector - Qt Creator" a few posts before.

        So, if MSCV 2022 does not include the complete list of include directories to look for when executing vcvars64.bat, Qt will never be able to learn where are they!!!

        Obviously, after installing Qt I've got exactly the same results: the list of folders to look for headers is, once more, the one reported in the said image, so my code does not compile.

        Curiously, compiling a simple C++ program using any of the offending headers (such as "math.h" or "string.h" using MSVC 2022 instead of Qt works without problems.

        So, having arrived to this point, I'm afraid there is nothing else I can do to solve the problem. My only guess is that, maybe, it is possible, somehow, to add manually the missing paths to Qt creator, but a quick Google search seems to contradict me. The usual answer is "you can't add MSVC manually, it must be autodetected".

        Any ideas from the experts?

        Thanks.

        1 Reply Last reply
        0
        • bleriot13B Offline
          bleriot13B Offline
          bleriot13
          wrote on last edited by
          #16

          Oh, my God.

          I have installed MSVC 2022 in my wife's laptop, which has never seen a compiler in its life, and there the INCLUDE variable is perfect, listing all the necessary paths located in c:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0* (the ones my laptop does not have).

          So, by some unknown reason, when I try to install MSVC 2022 in MY laptop, something goes wrong in spite of all the cleaning made.

          I know that this goes beyond the scope of this forum but, any ideas about what to do so the MSVC 2022 installer thinks that it's working in a brand new computer, with no history behind that might lead to this undesirable problem???

          Thanks.

          cristian-adamC JonBJ 2 Replies Last reply
          0
          • bleriot13B bleriot13

            Oh, my God.

            I have installed MSVC 2022 in my wife's laptop, which has never seen a compiler in its life, and there the INCLUDE variable is perfect, listing all the necessary paths located in c:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0* (the ones my laptop does not have).

            So, by some unknown reason, when I try to install MSVC 2022 in MY laptop, something goes wrong in spite of all the cleaning made.

            I know that this goes beyond the scope of this forum but, any ideas about what to do so the MSVC 2022 installer thinks that it's working in a brand new computer, with no history behind that might lead to this undesirable problem???

            Thanks.

            cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote on last edited by
            #17

            Maybe Repair Visual Studio helps somehow. 🤞

            bleriot13B 1 Reply Last reply
            0
            • bleriot13B bleriot13

              Oh, my God.

              I have installed MSVC 2022 in my wife's laptop, which has never seen a compiler in its life, and there the INCLUDE variable is perfect, listing all the necessary paths located in c:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0* (the ones my laptop does not have).

              So, by some unknown reason, when I try to install MSVC 2022 in MY laptop, something goes wrong in spite of all the cleaning made.

              I know that this goes beyond the scope of this forum but, any ideas about what to do so the MSVC 2022 installer thinks that it's working in a brand new computer, with no history behind that might lead to this undesirable problem???

              Thanks.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #18

              @bleriot13 said in QtCreator reports lots of headers as "not found":

              any ideas about what to d

              Yes: how about asking your wife to do the programming for you? ;-)
              Sorry, couldn't help it.

              Very difficult to help with this remotely. If necessary/just for testing, why don't you set your machine's INCLUDE or whatever to be the same as hers?

              bleriot13B 1 Reply Last reply
              0
              • JonBJ JonB

                @bleriot13 said in QtCreator reports lots of headers as "not found":

                any ideas about what to d

                Yes: how about asking your wife to do the programming for you? ;-)
                Sorry, couldn't help it.

                Very difficult to help with this remotely. If necessary/just for testing, why don't you set your machine's INCLUDE or whatever to be the same as hers?

                bleriot13B Offline
                bleriot13B Offline
                bleriot13
                wrote on last edited by
                #19

                @JonB Unfortunately, none of your two suggestions will work. First, programming is not exactly the kind of activity my wife would choose to make a living :-) so I discarded this solution immediately.

                Concerning the second one, the INCLUDE variable is set by a chain of batch files, since QtCreator uses these to retrieve the value of this and others environment vars. Changing these batch files is firstly difficult and secondly undesirable, since any update of the underlying MSVC 2022 compiler will restore these.

                At any rate, thanks for trying. I know that helping remotely is complicated.

                JonBJ 1 Reply Last reply
                0
                • cristian-adamC cristian-adam

                  Maybe Repair Visual Studio helps somehow. 🤞

                  bleriot13B Offline
                  bleriot13B Offline
                  bleriot13
                  wrote on last edited by bleriot13
                  #20

                  @cristian-adam This is what I'm doing right now, but I have no faith on this working at all. I'm starting to consider reinstalling Windows... :-(

                  1 Reply Last reply
                  0
                  • bleriot13B bleriot13

                    @JonB Unfortunately, none of your two suggestions will work. First, programming is not exactly the kind of activity my wife would choose to make a living :-) so I discarded this solution immediately.

                    Concerning the second one, the INCLUDE variable is set by a chain of batch files, since QtCreator uses these to retrieve the value of this and others environment vars. Changing these batch files is firstly difficult and secondly undesirable, since any update of the underlying MSVC 2022 compiler will restore these.

                    At any rate, thanks for trying. I know that helping remotely is complicated.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #21

                    @bleriot13
                    If you don't want to change the supplied MSVC batch files, you can always e.g. simply add an extra batch file which is invoked after them and alters/adds to INCLUDE variable. Just saying.

                    1 Reply Last reply
                    0
                    • cristian-adamC Offline
                      cristian-adamC Offline
                      cristian-adam
                      wrote on last edited by
                      #22

                      Re-installing Windows from time to time is a good idea. Forces you to think about things, where to store information, how to backup etc.

                      You could try two things:

                      1. Open Qt Creator from a Visual Studio Command Prompt, where I assume that the INCLUDE, LIB and PATH environment variables contain the necessary paths needed to compile the project.
                        With set INCLUDE=%INCLUDE% paths could be prepended or appended.

                      2. If Qt Creator works fine, one could then add in the Qt Creator's Preferences -> Environment -> System -> Environment the INCLUDE, LIB, and PATH values.

                      They would be global, affect all kits, but hopefully work as expected.

                      PATH=${PATH};\some\extrapath is the format of Qt Creator's macro expansion.

                      bleriot13B 1 Reply Last reply
                      1
                      • cristian-adamC cristian-adam

                        Re-installing Windows from time to time is a good idea. Forces you to think about things, where to store information, how to backup etc.

                        You could try two things:

                        1. Open Qt Creator from a Visual Studio Command Prompt, where I assume that the INCLUDE, LIB and PATH environment variables contain the necessary paths needed to compile the project.
                          With set INCLUDE=%INCLUDE% paths could be prepended or appended.

                        2. If Qt Creator works fine, one could then add in the Qt Creator's Preferences -> Environment -> System -> Environment the INCLUDE, LIB, and PATH values.

                        They would be global, affect all kits, but hopefully work as expected.

                        PATH=${PATH};\some\extrapath is the format of Qt Creator's macro expansion.

                        bleriot13B Offline
                        bleriot13B Offline
                        bleriot13
                        wrote on last edited by
                        #23

                        @cristian-adam This is a very good suggestion. In fact, in one of my previous posts I was asking where these variables could be set.

                        At any rate, it is much more than just probable that I will reinstall Windows. If things start to fail like in this case, I think it's time to reset the system.

                        Thanks!

                        1 Reply Last reply
                        1
                        • bleriot13B Offline
                          bleriot13B Offline
                          bleriot13
                          wrote on last edited by
                          #24

                          Well, reinstalling Windows did the trick. Now everything works as it always did.

                          A pity that posting in MS Visual Studio help forum takes about two weeks to get an answer. Or at least, this is what the bot that first answers you says.

                          Two weeks, yes.

                          Thanks to all of you.

                          1 Reply Last reply
                          1
                          • bleriot13B bleriot13 has marked this topic as solved on

                          • Login

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