Add code to the engine and compile the engine

I downloaded the source code from git, setted up the project in Xcode, and everything was working well.

I then added a new renderer class in the engine source

class FCustomShadingSceneRenderer : public FSceneRenderer

which is a copy of

class FDeferredShadingSceneRenderer : public FSceneRenderer

When I created the .h and .cpp files for my class it asked for which target it was, I clicked on UE4Editor - Mac, UE4Game - Mac and UE4XcodeHelper

Then I did Product → Build

Compile failed, here is the output of the external build tool

ExternalBuildToolExecution UE4Editor\ -\ Mac
    cd /Users//projects/UnrealEngine
    export ACTION=
    /Users//projects/UnrealEngine/Engine/Build/BatchFiles/Mac/Build.sh UE4Editor macosx Debug

Setting up Mono
Building UBT...
	 0 Error(s)
Building UE4Editor...
2015-10-21 13:58:02.999 defaults[22529:1077964] 
The domain/default pair of (/Users//Library/Preferences/com.apple.dt.Xcode, IDEBuildOperationMaxNumberOfConcurrentCompileTasks) does not exist
Running command : Engine/Binaries/DotNET/UnrealBuildTool.exe UE4Editor Mac Debug 
Creating makefile for UE4Editor (project files are newer)
Performing full C++ include scan (no include cache file)
Compiling with MacOSX SDK 10.10
Performing 189 actions (4 in parallel)
[3/189] Compile Module.Renderer.4_of_8.cpp
[1/189] Link UE4Editor-Engine-Mac-Debug.dylib
[2/189] Compile Module.Renderer.1_of_8.cpp
[4/189] Compile Module.Renderer.8_of_8.cpp
Undefined symbols for architecture x86_64:
  "operator<<(FArchive&, FSceneTextureShaderParameters&)", referenced from:
      FDownsampleSceneDepthPS::Serialize(FArchive&) in Module.Engine.6_of_30.cpp.o
      FDownsampleSceneDepthPS::Serialize(FArchive&) in Module.Engine.11_of_30.cpp.o
      FDownsampleSceneDepthPS::Serialize(FArchive&) in Module.Engine.14_of_30.cpp.o
      FDownsampleSceneDepthPS::Serialize(FArchive&) in Module.Engine.19_of_30.cpp.o
      FDownsampleSceneDepthPS::Serialize(FArchive&) in Module.Engine.22_of_30.cpp.o
  "FSceneTextureShaderParameters::Bind(FShaderParameterMap const&)", referenced from:
      FDownsampleSceneDepthPS::FDownsampleSceneDepthPS(FShader::CompiledShaderInitializerType const&) in Module.Engine.6_of_30.cpp.o
      FDownsampleSceneDepthPS::FDownsampleSceneDepthPS(FShader::CompiledShaderInitializerType const&) in Module.Engine.11_of_30.cpp.o
      FDownsampleSceneDepthPS::FDownsampleSceneDepthPS(FShader::CompiledShaderInitializerType const&) in Module.Engine.14_of_30.cpp.o
      FDownsampleSceneDepthPS::FDownsampleSceneDepthPS(FShader::CompiledShaderInitializerType const&) in Module.Engine.19_of_30.cpp.o
      FDownsampleSceneDepthPS::FDownsampleSceneDepthPS(FShader::CompiledShaderInitializerType const&) in Module.Engine.22_of_30.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: /Users//projects/UnrealEngine/Engine/Binaries/Mac/UE4Editor-Mac-Debug.app/Contents/MacOS/UE4Editor-Engine-Mac-Debug.dylib (No such file or directory)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: /Users//projects/UnrealEngine/Engine/Binaries/Mac/UE4Editor-Mac-Debug.app/Contents/MacOS/UE4Editor-Engine-Mac-Debug.dylib (No such file or directory)
[5/189] Compile Module.Renderer.7_of_8.cpp
[6/189] Compile Module.Renderer.5_of_8.cpp
[7/189] Compile Module.Renderer.3_of_8.cpp
[8/189] Compile Module.Renderer.2_of_8.cpp
[9/189] Compile Module.Renderer.6_of_8.cpp
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: /Users//projects/UnrealEngine/Engine/Binaries/Mac/UE4Editor-Mac-Debug.app/Contents/MacOS/UE4Editor-Engine-Mac-Debug.dylib
Total build time: 262.04 seconds

And here is the output message from Xcode

At first I had compile errors because I copy pasted the code, and some functions were being defined twice in the cpp code. I then put some of these functions in the .h, renamed other functions, and the errors weren’t showing up anymore.

Now I get this new error and I don’t know how to deal with it. Can someone help me please?

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: /Users//projects/UnrealEngine/Engine/Binaries/Mac/UE4Editor-Mac-Debug.app/Contents/MacOS/UE4Editor-Engine-Mac-Debug.dylib (No such file or directory)

Hi,

The file doesn’t exist, here is a screenshot of the files I do have

63635-cantfindfile.png

I retried it. I created a class with a static function, i’m including the .h file in SceneRendering.cpp, im compiling. It fails.

It means my new scripts, named CustomFracturesRenderer.h and CustomFracturesRenderer.cpp are not known by the compiling tool. I added them in the xcode solution right clicking on the folder I wanted to add it to, then clicking on new file. What should i do to make the engine know my files at compile time?

After a while I started from zero again and after created a new class I ran GenerateProjectFiles.command again so that the project knows about my new class. It worked.