Compile Project with CLion

I just recently installed UE4 on my Ubuntu 18.04. Usually, I am programming C++ in the CLion IDE and since there exists a UE plugin for CLion I thought everything would work out of the box. Well, it doesn’t. Trying to cmake my UE4 project in CLion gives me the error:

g++-8: error trying to exec '/usr/lib/gcc/x86_64-linux-gnu/8/cc1plus': execv: Argument list too long

which is caused by a huge list of arguments given to gcc. Most of these come from a cmake file in the ${PROJECT_FOLDER}/Intermediate/ProjectFiles/cmake-definitions.cmake. If I delete most of these (more than half of these are empty strings anyways) everything works and CLion can cmake and build the project.

My question is now: Since I deleted a lot of additional infomartion in cmake, will I run into problems later on? Which of those definitions that I deleted are really used later on? Are these even neccessary? What could I do differently so that I don’t have to delete these definitions in cmake and CLion will still compile the project? Thanks for any suggestions and help.

I have the same issue. You can make ‘production’ build though.
Change it in clion preferences > build, execution, deployment > cmake. Don’t know what are the implications.

you can try the patch from pull request 5006 it’s what I use.

You need to compile both

ProjectName | Debug


PrjectNameEditor | Debug

to get the completion working properly with UCLASS(). there is an error (or a wrong integration somewhere) where the Inc folder is created and filled with generated headers.

Additionally you do not build all targets and you do not care about the FakeTarget.

Usually when I create a new project I edit the configurations build and in the ProjectNameEditor I set the executable to be the UE4Editor binary and the argument to be the /home/USERNAME/Path/To/ProjectName.uproject

If your path as spaces in it just surround the whole path with double quotes.

You don’t “need” to compile ProjectName | Debug to launch the editor, but it will generate the headers you need for code completion.

Setting the configuration like I suggested will let you launch the Editor after compiling the ProjectNameEditor | Debug which is required to launch the editor.