Editor won't build if a source file is modified and the unmodified

Yes, you read that right.

I’ve got a c++ project, and in that project I have a plugin. The directory structure for the plugin code looks something like this…


Plugins
   |
   > myplugin
      | 
      > Binaries
      > Intermediate
      > Resources
      > Source
         |
         > myplugin
            |
            > Private
            |  |
            |  > core
            |  |  |
            |  |  > src
            |  |  |  |
            |  |  |  > folder_a
            |  |  |  |  |
            |  |  |  |  > compileissue.cpp (note includes "mycom.h" below)
            |  |  |  |  > folder_b
            |  |  |  |  |  |
            |  |  |  |  |  > mycom.cpp
            |  |  |  |  |  > mycom.h (<-- This is a subclass of ActorComponent, so its header includes the mycom.generated.h for what it is worth)



If I do this…

  • Delete every generated file from my project… Binaries, Intermediate, .vs, .sln, etc. (including those folders in the plugin’s directory)
  • Right click on my uproject and select “Generate Visual Studio Project Files”
  • Open resulting solution
  • Build

Project builds and runs fine.

If I then…

  • Touch compileissue.cpp in any way (e.g. it is in source control, so I check it out and add a space at the top of the file)
  • Build the project

Project won’t build. I get a bunch of compile errors (below)

If I then…

  • Open the file and remove the space I added
  • Build the project

Still doesn’t compile! The file is now identical to the file that built fine at the beginning.

OK. This is crazy. So I then…

  • Go to my Perforce client and I select revert unchanged files. compileissue.cpp is the only checked out file, so it reverts as it is unchanged.
  • Build the project

It builds!!! What the hell???

I have no idea how to begin debugging this.

This is the build output for what it is worth…



1>C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(536): warning C4005: 'TEXT': macro redefinition
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/Platform.h(839): note: see previous definition of 'TEXT'
1>C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(536): warning C4005: 'TEXT': macro redefinition
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/Platform.h(839): note: see previous definition of 'TEXT'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\WindowsSystemIncludes.h(10): note: see previous definition of 'SAFE_RELEASE'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Windows/WIndowsPlatform.h(81): warning C4005: 'CDECL': macro redefinition
1>  C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h(111): note: see previous definition of 'CDECL'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(127): error C2668: 'Windows::ConnectNamedPipe': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(125): note: could be 'Windows::BOOL Windows::ConnectNamedPipe(Windows::HANDLE,Windows::OVERLAPPED *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(102): note: or       'Windows::BOOL Windows::ConnectNamedPipe(Windows::HANDLE,Windows::LPOVERLAPPED)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um
amedpipeapi.h(61): note: or       'BOOL ConnectNamedPipe(HANDLE,LPOVERLAPPED)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(127): note: while trying to match the argument list '(Windows::HANDLE, Windows::LPOVERLAPPED)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(132): error C2668: 'Windows::GetOverlappedResult': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(130): note: could be 'Windows::BOOL Windows::GetOverlappedResult(Windows::HANDLE,Windows::OVERLAPPED *,Windows::LPDWORD,Windows::BOOL)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(103): note: or       'Windows::BOOL Windows::GetOverlappedResult(Windows::HANDLE,Windows::LPOVERLAPPED,Windows::LPDWORD,Windows::BOOL)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\ioapiset.h(52): note: or       'BOOL GetOverlappedResult(HANDLE,LPOVERLAPPED,LPDWORD,BOOL)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(132): note: while trying to match the argument list '(Windows::HANDLE, Windows::LPOVERLAPPED, Windows::LPDWORD, Windows::BOOL)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(137): error C2668: 'Windows::WriteFile': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(135): note: could be 'Windows::BOOL Windows::WriteFile(Windows::HANDLE,Windows::LPCVOID,Windows::DWORD,Windows::LPDWORD,Windows::OVERLAPPED *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(104): note: or       'Windows::BOOL Windows::WriteFile(Windows::HANDLE,Windows::LPCVOID,Windows::DWORD,Windows::LPDWORD,Windows::LPOVERLAPPED)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\fileapi.h(1149): note: or       'BOOL WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(137): note: while trying to match the argument list '(Windows::HANDLE, Windows::LPCVOID, Windows::DWORD, Windows::LPDWORD, Windows::LPOVERLAPPED)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(142): error C2668: 'Windows::ReadFile': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(140): note: could be 'Windows::BOOL Windows::ReadFile(Windows::HANDLE,Windows::LPVOID,Windows::DWORD,Windows::LPDWORD,Windows::OVERLAPPED *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(105): note: or       'Windows::BOOL Windows::ReadFile(Windows::HANDLE,Windows::LPVOID,Windows::DWORD,Windows::LPDWORD,Windows::LPOVERLAPPED)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\fileapi.h(932): note: or       'BOOL ReadFile(HANDLE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(142): note: while trying to match the argument list '(Windows::HANDLE, Windows::LPVOID, Windows::DWORD, Windows::LPDWORD, Windows::LPOVERLAPPED)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(147): error C2668: 'Windows::InitializeCriticalSection': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(145): note: could be 'void Windows::InitializeCriticalSection(Windows::CRITICAL_SECTION *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(87): note: or       'void Windows::InitializeCriticalSection(Windows::LPCRITICAL_SECTION)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(162): note: or       'void InitializeCriticalSection(LPCRITICAL_SECTION)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(147): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(152): error C2668: 'Windows::InitializeCriticalSectionAndSpinCount': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(150): note: could be 'Windows::BOOL Windows::InitializeCriticalSectionAndSpinCount(Windows::CRITICAL_SECTION *,Windows::DWORD)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(88): note: or       'Windows::BOOL Windows::InitializeCriticalSectionAndSpinCount(Windows::LPCRITICAL_SECTION,Windows::DWORD)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(203): note: or       'BOOL InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(152): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION, Windows::DWORD)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(157): error C2668: 'Windows::SetCriticalSectionSpinCount': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(155): note: could be 'Windows::DWORD Windows::SetCriticalSectionSpinCount(Windows::CRITICAL_SECTION *,Windows::DWORD)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(89): note: or       'Windows::DWORD Windows::SetCriticalSectionSpinCount(Windows::LPCRITICAL_SECTION,Windows::DWORD)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(241): note: or       'DWORD SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(157): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION, Windows::DWORD)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(162): error C2668: 'Windows::TryEnterCriticalSection': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(160): note: could be 'Windows::BOOL Windows::TryEnterCriticalSection(Windows::CRITICAL_SECTION *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(90): note: or       'Windows::BOOL Windows::TryEnterCriticalSection(Windows::LPCRITICAL_SECTION)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(260): note: or       'BOOL TryEnterCriticalSection(LPCRITICAL_SECTION)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(162): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(167): error C2668: 'Windows::EnterCriticalSection': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(165): note: could be 'void Windows::EnterCriticalSection(Windows::CRITICAL_SECTION *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(91): note: or       'void Windows::EnterCriticalSection(Windows::LPCRITICAL_SECTION)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(179): note: or       'void EnterCriticalSection(LPCRITICAL_SECTION)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(167): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(172): error C2668: 'Windows::LeaveCriticalSection': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(170): note: could be 'void Windows::LeaveCriticalSection(Windows::CRITICAL_SECTION *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(92): note: or       'void Windows::LeaveCriticalSection(Windows::LPCRITICAL_SECTION)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(187): note: or       'void LeaveCriticalSection(LPCRITICAL_SECTION)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(172): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(177): error C2668: 'Windows::DeleteCriticalSection': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(175): note: could be 'void Windows::DeleteCriticalSection(Windows::CRITICAL_SECTION *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(93): note: or       'void Windows::DeleteCriticalSection(Windows::LPCRITICAL_SECTION)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\synchapi.h(270): note: or       'void DeleteCriticalSection(LPCRITICAL_SECTION)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(177): note: while trying to match the argument list '(Windows::LPCRITICAL_SECTION)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(182): error C2668: 'Windows::QueryPerformanceCounter': ambiguous call to overloaded function
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(180): note: could be 'Windows::BOOL Windows::QueryPerformanceCounter(Windows::LARGE_INTEGER *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(108): note: or       'Windows::BOOL Windows::QueryPerformanceCounter(Windows::LPLARGE_INTEGER)'
1>  C:\Program Files (x86)\Windows Kits\8.1\include\um\profileapi.h(42): note: or       'BOOL QueryPerformanceCounter(LARGE_INTEGER *)' [found using argument-dependent lookup]
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\MinimalWindowsApi.h(182): note: while trying to match the argument list '(Windows::LPLARGE_INTEGER)'
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\windows\WindowsSystemIncludes.h(10): warning C4005: 'SAFE_RELEASE': macro redefinition
1>c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Windows/WindowsPlatformAtomics.h(18): error C2665: 'FWindowsPlatformAtomics::_InterlockedIncrement': none of the 2 overloads could convert all the argument types
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Windows/WindowsPlatformAtomics.h(22): note: could be 'int64 FWindowsPlatformAtomics::_InterlockedIncrement(volatile int64 *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Windows/WindowsPlatformAtomics.h(16): note: or       'int32 FWindowsPlatformAtomics::_InterlockedIncrement(volatile int32 *)'
1>  c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Windows/WindowsPlatformAtomics.h(18): note: while trying to match the argument list '(long *)'


Hey! I have same question, how do you solve it?

Did this ever get solved? I’m having the same errors.

It happened the same to me, the problem was because I was including an external library (boost), and the header file I was using was including windows.h so I fix it including the unreal windows headers


#include "AllowWindowsPlatformTypes.h"

//The external headers and defines goes here

#include "HideWindowsPlatformTypes.h"