Error generating Xcode project after project opened in Windows

When you have a C++ project that is created on a Mac, if you open that project from its current location in the Windows version of UE4, then go back to the Mac and try to re-generate the Xcode project, you get errors [console log at end of post].

It’s relatively easy to fix - just delete the ._ProjectName.Build.cs file, however since that file is invisible on a Mac, the solution may not be immediately obvious to some users. Ideally, the generate service should know to ignore files that begin with ._ when compiling, since they contain Visual Studio-specific metadata and the file extension can’t reliably be used to know how to parse the data.

Discovering modules, targets and source code for game...
Errors detected while compiling /Volumes/GAMEDEV/Animations/Intermediate/Build/BuildRules/RocketUE4ModuleRules.dll:
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,2) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,3) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,4) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,6) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,8) : error CS1525: Unexpected symbol `Mac'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,26) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,37) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,38) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,42) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,45) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,46) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,49) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,50) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,92) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,95) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,96) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,100) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,104) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,120) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,124) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,128) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,131) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `�'
/Volumes/GAMEDEV/Animations/Source/Animations/._Animations.Build.cs(1,255) : error CS1056: Unexpected character `�'
UnrealBuildTool Exception: ERROR: UnrealBuildTool encountered an error while compiling source files

Hey -

I’m having a little difficulty understanding the flow of what is happening here. You create a project on a Mac first. Do you then make a copy to transfer to Windows machine? What do you mean by “open that project from its current location”? In the last step are you opening the original Mac project or are you copying it from Windows back to Mac?

The project is on a NAS device. I realize not a recommended or ideal use case, and not one I use in normal development, but still thought it worth mentioning because there are several avenues to getting this result. Somebody accidentally checking in visual studio metadata files into the repository, for example, a build server that builds for multiple platforms, so in an ideal world, the generate Xcode project would ignore any ._ file, or really, any . file.

Hey -

We are still investigating this string of errors when swapping OS. I will update you once I have more information.

Hey -

After some testing on our end we were unable to reproduce the error you mentioned. Here are the steps taken to test the problem:

Using 4.11 Preview 8 Binary (both Mac and PC)

  1. Create code project in mac, and saved to an external drive (exFAT)
  2. Bootcamp to load Windows 7 SP1
  3. Generate Visual Studio Profile files (Visual Studio 2015 Update 1)
  4. Make a change to code, compile, and make sure its update in game
  5. Switch Back to Mac, Recompile changes, New changes working (no errors or warning).
    ==Also Tried==
  6. Delete Mac Project Files (.xcworkspace) , and manually force regenerating XCode Project files. No errors

There are a few questions I’d like to ask to help us investigate this issue further.

  • Are you on the 4.10.4 binary engine or a source build engine?
  • If you’re using source, which hotfix are you using (.0/.1/.2/.3/.4)?
  • Which version of the Windows / Mac OS are you using?
  • What version of XCode / Visual Studio are you using?
  • Are you able to reproduce this in a new project (is there any specific plugin or content that may be triggering this error)?
  • How is the NAS formatted (exFAT / NTFS)?

Are you on the 4.10.4 binary engine or a source build engine?

That particular project was using a binary build of 4.10.4. I do have a source version of the engine on both machines, but that project was always built against binary.

If you’re using source, which hotfix are you using (.0/.1/.2/.3/.4)?

N/A

Which version of the Windows / Mac OS are you using?

Windows 10, Mac OS X

What version of XCode / Visual Studio are you using?

Xcode 7.3, Visual Studio 2015 update 2

Are you able to reproduce this in a new project (is there any specific plugin or content that may be triggering this error)?

Unfortunately, I will not be able to get you an answer on this one for a few days. My Windows machine has been packed up for an office move and won’t be available to me for close to a week. Once my machine is back up in the new office, I will try from a fresh project.

How is the NAS formatted (exFAT / NTFS)?

NTFS

Hey -

I apologize for the late reply. Thank you for the additional information, I am speaking with some other engineers to interpret the information and will respond when I have more information.

Hey ,

We tried to test as close to the same setup you described (using a very large NTFS NAS) but were unable to reproduce the build errors. If you are able to make a copy of the project, can you let us know if deleting the Saved, Intermediate and Binaries folders and then generating the xcode files again allows the build to complete? Also let me know if you’re able to reproduce this on a new Code Template.

Hi ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

I’m having the same problem. I worked on the project on windows and mac and am having this error when I try to make the package ("._"). I do not know how to solve the problem, could you help me?

Running dot_clean -m . in your project directory should fix this. The problem is, the Unreal build system is not excluding the dot underscore files that get created on non-HFS volumes to hold metadata. Since they have the same file extension as the file they contain metadata for, they look like the same type of file. So:

MyAwesomeFile.cpp would have metadata stored in
._MyAwesomeFile.cpp which the build system thinks is C++, but is actually HFS+ metadata.

You can be more specific in “Running dot_clean -m . in your project directory should fix this.”? I’m a newbie in this kind of thing, sorry

  1. Open a terminal window
    (/Applications/Terminal.app)
  2. type cd /path/to/UnrealProject.uproject
    (replacing with the path to your
    actual directory)
  3. type dotclean -m .
  4. Wait for it to finish deleting all the metadata files
  5. Right-click on the .uproject file and regenerate the Xcode project.

Can not do this on a windows machine? I have this problem when I try to do Package Project

Ah, if you don’t have a Mac available, maybe try this? Windows tool to clean up OS X junk files – mark shroyer, dot com

It turns out the problem was caused by the metadata files (._XXX.xxx that Mac OS X litters around non-HFS drives. The build system was trying to process the metadata files based on their extension (e.g. it tries to handle the metadata file ._MyClass.cpp as if it was a c++ file). Cleaning up the dot underscore files with dot_clean from a Mac fixes the problem. Ideally, it would be nice if the build system ignored dot underscore files, but this is a usable workaround.

It worked! Thank you so much, I did not know what to do. You save my day ahahah