Announcement

Collapse
No announcement yet.

Suddenly can't compile (Error C4668)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Suddenly can't compile (Error C4668)

    I was having no problems until I added `#include <string>` to one of my header files. Even after removing that line though, I still get the following errors:
    ```
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(584): warning C4005: 'TEXT': macro redefinition
    c:\program files\epic games\ue_4.22\engine\source\runtime\core\public\HAL/Platform.h(904): note: see previous definition of 'TEXT'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7542): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7548): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7553): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7557): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7564): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7574): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7578): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7583): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7777): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12249): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12266): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12285): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12404): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    [4/7] SurfaceCheck.cpp
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(584): warning C4005: 'TEXT': macro redefinition
    c:\program files\epic games\ue_4.22\engine\source\runtime\core\public\HAL/Platform.h(904): note: see previous definition of 'TEXT'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7542): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7548): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7553): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7557): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7564): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7574): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7578): error C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7583): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(7777): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12249): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12266): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12285): error C4668: '_WIN32_WINNT_WIN10_RS2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winioctl.h(12404): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

    ```

    I've seen that people have had similar problems before when upgrading from 4.19 to 4.20, but this is not the case for me and none of the existing solutions resolve the issue

    #2
    Yea, don't add Standard Lib includes. It's asking for trouble.UE overloads quite a few Macros / defines that those includes tend to use.

    You likely need to rebuild your solution to clean out any generated headers that copied over that include statement. You can also regenerate your solution just to be really safe (right click on your UProject file -> Generate Visual Studio Solution).
    Able Ability System - A high performance, robust ability system for UE4. Now Available!

    Comment


      #3
      Hm. I've rebuilt and generated VS solution, but the problem still persists. Other options?

      Comment


        #4
        Search for "Binaries" in your project folder and delete every Binaries folder you find. Then re-generate the project again, then load it and just check to see if it all makes sense - e.g. no odd includes, it's only trying to build the main project, etc.

        Then quit VS and load your uproject file instead and let UE handle the entire build. If that fails grab the log file it output.

        Comment


          #5
          So I did that. The project file can't be opened directly anymore. I get a popup message saying that there are missing modules. If I try to rebuild them, I get a "compile failed" message. Building from VS still produces the exact same errors.

          Comment

          Working...
          X