Qt Creator C1083: Cannot open include file: 'cstddef': No such file or directory

10,962

Solution 1

First of all, when you compile your project under Qt Creator, you're using a particular kit, tied to a particular installed Qt version. Make sure that the configuration of that kit and that Qt version in Qt Creator has the right compiler selected. C++ code is generally not binary compatible across compilers, so if you've installed a Qt version for say MSVC2012, it'll only work with that compiler and no other. If you're not building Qt yourself, the Qt version you installed must match the compiler you're using it with. Mixing MSVC versions or using a MSVC-built Qt with mingw gcc won't work.

You can have multiple installations of Qt side by side, and each installation can use a different Qt version and/or compiler. You need to let Qt Creator know about them by adding them to the Qt Versions control pane, and then setting up the kits that use these Qt versions.

There's no point to running vcvars yourself, since it only sets the environment variables for that particular instance of the command processor. It has no effect on Qt Creator. Qt Creator's build system automatically invokes vcvars to set up an environment that the build is executed in.

Solution 2

Deleting content of the "c:\Users\user\AppData\Roaming\QtProject" folder worked for this error in my case again:

Qt Creator 4.0.1 (Qt 5.6.2 MSVC2015 32bit) stopped accepting toolchains/compilers

update: my suggested solution worked only sometime, other solution was restarting computer and now neither works. Accepted answer does not work for me.

Share:
10,962
TajniakOsz
Author by

TajniakOsz

Updated on June 27, 2022

Comments

  • TajniakOsz
    TajniakOsz almost 2 years

    I try to build a programm in Qt Creator (Qt5.7.0) on Windows 10 but I get

    D:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore\qglobal.h:45: error: C1083: Cannot open include file: 'cstddef': No such file or directory

    error message. I found out that it may be caused by lack of Windows SDK but I installed it, ran vcvarsall.bat and nothing happened. I try to use "MinGW 5.3.0 32-bit" compiler and "GNU gdb 7.10.1 for MinGW 5.3.0 32-bit" debugger (using "Microsoft Visual C++ Compiler" doesn't work as well). Any ideas?