Where do I specify compiler options?

(After a lengthy time away from C++, using C# exclusively for programming, I have jumped back in feet first, so please bear with me. I do appreciate the vast differences in paradigms between the languages.)

I have started a new UE4 project with an initial goal of including the open mesh library (http://openmesh.org/) in the project and beginning to use it. I am using Visual Studio Community 2013, UE4 4.5.1, and Open Mesh (.dlls, opposed to static). I have installed UE from the Library. I have quite a few questions, but here is the result of me trying to include Open Mesh inside UE4.

After adding include and lib folders to the VC++ directories and only adding an include reference at the top of a custom c++ class #include I get the following error. E:\Dev\OpenMesh 3.2\include\OpenMesh/Core/System/compiler.hh(105): fatal error C1189: #error : “Enable Runtime Type Information (Compiler Option /GR)!”

The compiler code from the Openmesh library that is throwing that is…

#  if defined(__cplusplus) && !defined(_CPPRTTI)
#    error "Enable Runtime Type Information (Compiler Option /GR)!"
#  endif
#  if !defined(_USE_MATH_DEFINES)
#    error "You have to define _USE_MATH_DEFINES in the compiler settings!"
#  endif

This was a same error I ran into when doing a simple c++ startup application as a get reaquainted with c++ test and was quickly resolved by adding the option in Visual Studio by right clicking the project and adding it under the compiler options. However I don’t have that option here. When I right click the project I only get the VC++ options, not C++.

So here is my question and a couple of other resultant questions from trying to fix this initially…

  1. Where do I set that option if that even is the right approach?
  2. I wanted to generate the project files using the GenerateProjectFiles.bat file, but I do not have that in the Unreal Engine\4.5\Engine\Build\BatchFiles folder, I only have RocketGenerateProjectFiles.bat file. I understand that rocket is a leftover name from the projects early days, but is that I should use now OR do I need to download the full engine source to get that? I did try running the Rocket one and ran into the error UnrealBuildTool Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\Dev\Unreal Engine\4.5\Engine\Source\Programs\UnrealBuildT ool\UnrealBuildTool.csproj'.
  3. I did choose dll vs static for the openmesh library. Is that the right way to go?
  4. Is including an external library like this considered changing the engine enough to work from git instead of using the library?

I recognize that I am skirting around an incredible amount of c++ issues, so I appreciate any patience.

Thanks, Al

1 Like

I feel you bro, I struggle with exactly the same thing.

Yea, OpenMesh is a pain to get working. I wish it was a header-only library written in modern C++11.

Anyways, make sure you do this in your Blah.Build.cs

public class Blah: ModuleRules
{


    public Blah(TargetInfo Target)
	{
        bUseRTTI = true;
//...

Getting it working past this is annoying. I didn’t want to spend too much time so I hacked the following:

They have a DEPRECATED macro that messes up Unreal’s class macro system. I deleted all of their deprecated methods and their definition of the DEPRECATED macro in config.h. The methods are deprecated, I’m not using them, so there is no harm (except if I want to use their latest code).

You will also need to get rid of the line in compiler.hh:

#  if !defined(_USE_MATH_DEFINES)
#    error "You have to define _USE_MATH_DEFINES in the compiler settings!"
#  endif

M_PI seems to be defined for Unreal, so, that’s nice.

1 Like