x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UE4 Program linking the Engine

Is it possible to link the Engine in a Program?

I've seen that every other program basically has the UEBuildConfiguration.bCompileAgainstEngine = false;. However, I tried it out as true and I've come a long way of adding modules and include paths to my Build.cs, as well as testing out some UEBuildConfiguration values in my Target.cs, until It seemed I was going to get it right, but suddenly I came into the following error:

 unresolved external symbol "bool GIsConsoleExecutable"
 
 // which is called in the PreInit() function inside the main
 INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
 {
     GEngineLoop.PreInit(ArgC, ArgV);
     UE_LOG(LogTestProgram, Display, TEXT("Hello World"));
     return 0;
 }

I don't know how to deal with that unresolved external, I've only found it in the PreInit() function as an extern bool in the LaunchEngineLoop.cpp file, and also in the Launch.cpp file as a bool declared as false. Both those files were in my include paths by default when I started out by copy pasting the BlankProgram provided.

Why I am trying to link the Engine

The main reason for this has to deal with TDD. I'm not really confortable with the testing framework provided by UE, it doesn't fit my workflow at all. So, I thought about using my usual unit testing library within a program, but I obviously need to have the Engine classes referenced.

After overcoming a lot of compilation errors I'm now asking myself whether there is a reason for not linking the Engine in a UE Program. As of TDD, I always have my tests in another project that references the one being tested, and that's usually the way to go for everyone.

How may I correct that error, or what would be the correct way for getting my TDD library into UE as long as I'm able to run its very own executable file?

I'm pretty sure the only way to get an executable console application in UE is within a Program, please prove me wrong if that's not the case.

Thank you.

Product Version: UE 4.9
Tags:
more ▼

asked Oct 10 '15 at 03:23 AM in C++ Programming

avatar image

Suui
141 3 6 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I was able to solve the above error and it was ofc because of my own misunderstanding of what the extern keyword was. I finally understood it thanks to this stackoverflow post: http://stackoverflow.com/questions/10422034/when-to-use-extern-in-c

The code now compiles with:

 bool GIsConsoleExecutable; 
 
 INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
  {
      GEngineLoop.PreInit(ArgC, ArgV);
      UE_LOG(LogTestProgram, Display, TEXT("Hello World"));
      return 0;
  }

I still don't know if it's correct to link the engine against a program. But I finally found the answer I really wanted for Unit Testing with the library I use, thanks to this post by Wolfjagger:

https://answers.unrealengine.com/questions/226347/use-c-classes-in-unreal-project-in-another-c-proje.html

and the forum link he provided with his solution:

https://forums.unrealengine.com/showthread.php?71074-How-to-integrate-third-party-unit-testing-with-modules

more ▼

answered Oct 11 '15 at 10:56 PM

avatar image

Suui
141 3 6 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question