How to use Clion with UE4.20 ?

Hey everyone,

I recently started learning UE with Udemy but I’m having trouble using Clion. I did the following:

  1. Check the Clion plugin in Edit > Plugins > Programming > Clion
  2. Generate CLion project

But from here, when I open CLion, I only have the CMakeLists and can’t see the Source folder.
I refreshed the Project, rebuilt it, removed the .idea folder but nothing is working. What did I miss ?

EDIT: Forgot to mention that I am on MacOS, using UE4.20 and CLion 2018.2

Hope you all have a nice day !

What platform?

In order to use CLion with UE on Mac you need to follow a few steps:

  1. Create a Project using the usual editor.
  2. Launch the Project from the Editor and accept ask him to compile the project.
  3. Once the project is launched go to Editor Preferences and in the Source Code select CLion.
  4. In the main window go to File and in the Dropdown menu select Refresh Project Files.
  5. Once it is Compiled launch CLion from the same Dropdown menu.

These are the few steps needed to clean the project CMakeLists.txt once CLion is launced:

  1. In the CMakeLists.tx comment out the 3 include() that are cmake-headers-ue4.cmake, cmake-sources-engine.cmake and cmake-csharp-engine.cmake
  2. in the cmake-includes.cmake check if “/Users/Path/To/Project/Intermediate/Build/MacOS/UE4Editor/Inc/ProjectName” is part of the list and if not add it
  3. go to Run/Debug Configurations and select ProjectNameEditor and set as an Executable /Path/To/Unreal/Engine/UE4Editor.app/Content/Build/MacOS/UE4Editor (not sure about the path inside the app but it’s there somewhere)
  4. set Program arguments as /path/to/project/projectane.uproject

and you should be ok to go

Remember that each modifications of the cmake files will be overwrite if you add a class or refresh the clion solution within the UE editor

Sorry I forgot to mention it, I’m on MacOS

I did these steps but It is not working, I still have only the CMakeLists.txt and the .uproject in my project tab.

However, if I open CLion manually, it shows me everything but does not hot-reload

You should be able to launch the project editor using the green arrow next to build button if you follewd the Executable steps. However hot reload is also available when compiling from withing the game editor

Ohh ok I see, thanks for the help!

Hi!

I’m doing the same Udemy course with UE 4.21.2 and CLion on a Mac.
Did someone managed to fix this error?

The IDE does not recognize UCLASS. Not even the GetWorld()->something is working.

Standard Includes

include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-includes.cmake")
include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-definitions.cmake")
#include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-headers-ue4.cmake")
include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-headers-project.cmake")
#include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-sources-engine.cmake")
include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-sources-project.cmake")
#include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-csharp-engine.cmake")
include("/Users/ignacio.nieto/BuildingEscape/Intermediate/ProjectFiles/cmake-csharp-project.cmake")

Thanks!