How to build&run Unreal C++ project on Linux? - c++

I'm trying to build my first Unreal C++ project on Linux.
I built the engine from source in accordance with "Linux Quick Start" guide. Then I installed Qt Creator and followed the "How to Set up Qt Creator for UE4" guide.
I successfully set up and ran UE4Editor, and created a new C++ project. Unfortunately when I try running the project it complains:
And when I press "yes" this error message is shown:
Here's the error message from the logs:
ERROR: Building would modify the following engine files:
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/Android/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Plugins/2D/Paper2D/Binaries/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Plugins/AI/AISupport/Binaries/Linux/UE4Editor.modules
... many more
I tried rebuilding UE4 from IDE, then building again - but the error still persists. Same thing happens if I try starting UE4Editor from the engine files and opening the project from there.
What could cause this error? Why does it even try to rebuild the engine when I'm tring run a project?

I have the following script to add the paths to the engine scripts and binaries to my PATH:
UNREAL_HOME="/path/to/source/of/UnrealEngine"
UNREAL_SCRIPTS="${UNREAL_HOME}/Engine/Build/BatchFiles"
UNREAL_SCRIPTS_LINUX="${UNREAL_HOME}/Engine/Build/BatchFiles/Linux"
UNREAL_BINS="${UNREAL_HOME}/Engine/Binaries/Linux"
PATH="${PATH}:${UNREAL_BINS}:${UNREAL_SCRIPTS}:${UNREAL_SCRIPTS_LINUX}"
export PATH
Then I run UE4Editor '/absolute/path/to/project.uproject' from within the directory of my project.
I never create a project inside the source tree of the engine. Paths should absolutely be different.
I use VS-Code as the IDE. This is what works best from my experience. QT-Creator will work only if you create an include files with lots of #define that are missing from the .pro files created by unreal.
You can configure VS-Code to have an intelli-sense like completion by installing the C# and C/C++ extensions. I had to install mono in order to get OmniSharp working (this is the server than handles the autocompletion for VS-Code). Here is an extract of my VS-Code settings.json file:
"omnisharp.path": "/home/myuser/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/OmniSharp.exe",
"omnisharp.monoPath": "/usr/bin/mono",
You can also install the C++ Helper extensions which is usefull for creating methods, classes, and so on.

In the directory of your project run 'make YOURPROJECTNAMEEditor', then you can run 'open YOURPROJECTNAME.uproject' and it should open.

Related

Source environment variables before running cmake in VSCode

I am trying to build a large C++ framework in VSCode using CMakeTools and C/C++ Extensions in Visual Studio Code. I am browsing stackoverflow/github issues/any google suggestion and it looks like I am not the first person to encounter this, but I can not figure out for the life of me what am I doing wrong.
Here is the problem. I want to setup VSCode in a way to be able to build the framework (it is C++) right from VSCode using the built-in tools/extensions. Here is the process I was using up until now (in standard terminal in linux) and it also works in terminal run in VSCode:
cd /path-to-project-main-folder
source scripts/env.sh
cmake .
make -j 10
Now the problem is that when I set up VSCode, open the folder where the framework is, VSCode recognizes it is cmake project and gives me the opportunity to build it. Problem is that when I try to build it, it does not set up the environment first and therefore uses wrong cmake (not the sourced one but the default one build in server) and also wrong libraries and some of them are not even recognized.
The problem is in the first line:
source scripts/env.sh
where the environment variables are set and also PATHs to some libraries and programs. This line is not ran by VSCode before cmake and build.
Does anyone know a solution on how to configure CMakeTools extension to run:
source scripts/env.sh
line before running cmake and then make?
Thank you
I was looking into some solutions using tasks.json, settings.json files or creating my own kit. But no solution worked for me or I did not completely undestood the solution:
https://github.com/microsoft/vscode-cmake-tools/blob/HEAD/docs/tasks.md
https://github.com/microsoft/vscode-cmake-tools/issues/2243
https://github.com/microsoft/vscode-cmake-tools/pull/995
VSCode: Set environment variables via script
and man pages of CMakeTools, VSCode,...
VScode remote development: How can I run a build task to source environment variables before running the real build task? ---> but I use cmake
VSCode, how to source environment variable files like setup.bash?

eclipse C++ remote compilation using cmake

Till now we are compiling our C++ project in CentOS using cmake files. Everything is working fine, now instead of putty we are looking for an IDE which will do the job from windows.
I tried with eclipse but not getting step by step documents which will do. I tried in eclipse neon and eclipse for C++ development. All works fine for local but when I say build should happen on Centos nothing works.
Using ssh remote system explorer able to view all the files.
selected the folder in system explorer and "Create remote project".
Able to see the project in the project explorer and all my files/folders are present and .project files also present.
in the .project file apart from name rest other tags are empty.
All the source folder has CMakeList.txt but how to use that in eclipse is question?
When I say build on eclipse it should build the src code on Centos.
Not sure which version of eclipse and additional tools needs to be installed.
If anyone have done already do let me know the execution steps.
Thanks
Vj

Via Windows command line, how can we compile a Netbeans C/C++ application?

Let's take this simple C/C++ application Netbeans project folder.
In Netbeans IDE, we just hit build button on the toolbar to build the application.
I want to do that automatically via Windows command line, how can I do that?
I did google, and found some related posts though not very helpful for me except telling me to call ant dist - though I don't have the build.xml in my Netbeans 8 project.
p.s. I have hundreds of student submissions and need to verify which one is compilable.
I also post on Netbeans forum here.
I want to do that automatically via Windows command line, how can I do that?
NetBeans uses Makefile-based projects as default for C/C++ projects, so you can use make to build your project:
cd <Project dir>
make
It's also possible to build other make-targets (eg. make all or make test (builds / runs tests)).
Note: The Cygwin bin dir (CYGWIN_HOME\bin) must be in system PATH - same applies to other environments (MinGW, Gcc etc).

How to integrate chromium browser project in Qt Creator in Ubuntu

I have managed to understand the structure of chromium browser and now I would like to use an IDE in order to make some changes for a personal project on a Ubuntu Trusty machine ( 14.04 ).
It is already compiled and I just want to use an IDE to make my life easier.
I have tried to add chromium to Qt Creator by using the option open project but without any luck.
Could you please guide me to have this achieved ? Some steps would be really helpful. More, it would be possible to compile / build chromium from Qt Creator ? ( avoid typting in console ninja -C out/Debug chrome chrome_sandbox and out/Debug/chrome every time)
If you guys can suggest me another IDE that you're used to, please, guide me and I will change the title of the post.
//UPDATE 1
I tried to make those configurations for Build / Run as it follows:
Build:
Run
I get the following error:
:-1: error: No rule to make targetall'. Stop.`
//UPDATE 2:
The error from Compile output section
You can edit any code project in Qt creator, but you can't use Open project, when it isn't a Qt project. Instead use Import project -> Import existing project in the New project dialog.
When you have an existing project, you can define new build steps in the Projects tab. Under Build steps just choose Add Build step -> Custom Process step.
Here you can fill in your command using the fields Command, Arguments and Working Directory.
In your case, you would for example fill in ninja, -C out/Debug chrome chrome_sandbox and %{buildDir} for the first command.
Similarely, you can click on Run (on the top of this tab) to change how the your project is executed after successful compilation.
Just run in src folder:
gn gen out/Default --ide=qtcreator
And open in QtCreator src/out/Default/qtcreator_project/all.creator

"Launch failed. Binary not found." error on CDT Kepler Eclipse

Running or debugging anything gives me an extremely frustrating "Launch failed. Binary not found" error. I'm using Eclipse with a CDT plugin installed (specifically, I have the MinGW package installed).
I already tried setting both the user and system PATH variables to include my (MinGW directory)/bin
I also tried building the program before running it.
I also made sure that PE Windows Parser under the project's settings was enabled.
I went to Project Properties > Run/Debug Settings > New > C/C++ Application > Environment > Select > and I selected the Path
I also tried setting the C/C++ Application in the Main tab to the executable file that is made from building the program, but no such file is made when I do build my program. I seriously doubt that this is what's causing the problem, though.
I'm running out of options, and the problem still persists. What else needs to be done? What am I doing wrong?
When I was looking through the install instructions for MinGW, the tutorial referenced the mingw base package as the package to install after installing MinGW. But mingw base was not available to me. Instead, I saw mingw32 base. Could it be that Eclipse, a 64 bit program, is trying to run 32 bit code? Is that what's going on? If that's the problem, how do I fix it?
Build
Refresh the project. A new folder named Binaries will appear now in project explorer.
Now Run :)
It took me 3 days to figure out my problem. My Hello World C program would compile in eclipse using the Windows PE Parser, but there was NO EXE FILE!!!! AVAST Antivirus was identifying the exe file as a false positive and removing it....grrrrr. The solution was to add the eclipse workspace folder to the exclusions list. Voila!! Eclipse generated my test.exe file.
save the file first before you build and run... it works with me
Check the compiler you set while you created the project . If that is MINGW or Visual Studio ; check whether they are downloaded or not . If not do so and start a new project by closing the old one . Build the new project by pressing Ctrl + B and a new file 'Binaries' is created in the package explorer . Now you can use the run option to run the project .
First the solution: install "make"
I had the same issue.
I also tried the steps you did with no luck.
After some time i found a the solution!
The problem was that i did not have the application "make".
Apparently its not installed by default on Cygwin and eclipse doesn't give any indication for that...