Unreal + ROS? "cannot use typeid with -fno-rtti"

Hi all,

I’m trying to use [ROS][1] with Unreal, but there is no way to make it works.

First, after insert the #include "ros/ros.h" on my Source/MyProj/MyProjPawn.cpp, I had problems because the compiler didn’t find the ros.h file.

So, I added the /opt/ros/kinetic/include/ path to my Source/MyProj/MyProj.Build.cs using the code below:

PublicIncludePaths.AddRange( new string[] { "/opt/ros/kinetic/include/" } );

after that, when compiling the project, the compiler can find the ros.h file, but I have a lot of compiling errors and one of them is cannot use typeid with -fno-rtti.

The list of errors are:

Error 1 - /opt/ros/kinetic/include/ros/publisher.h:85:22: error: cannot use typeid with -fno-rtti

Error 2 - /opt/ros/kinetic/include/ros/service_client.h:108:5: error: cannot use 'try' with exceptions disabled

Error 3 - /opt/ros/kinetic/include/ros/master.h:80:18: error: expected unqualified-id

128835-error3.png

Anyone of you got through these problems? Do you know how to solve at least 1 of these 3 problems?
I’m asking here because I already spent a whole week trying to make this simple #include "ros/ros.h" works but I wasn’t able to do it.

Thanks in advance for the answers.

First, Take a look at the UE4Duino project. It was showcased some time ago. Also, it may be a better idea to think of using something like that project to pipe the data you may wnt to be manipulating into unreal for you.

Hi @cpyarger , I’ve downloaded the code of UE4Duino project and analysed it, but it didn’t help.

Anyway, thank you for your answer.

You can enable RTTI in the Target.cs file of your project, by adding

	UEBuildConfiguration.bUseRTTI = true;

to SetupGlobalEnvironment().

The errors happened to me with Unreal 4.14.x
Adding bUseRTTI didn’t solve the problem.

The two first errors (-fno-rtti, try) only disappeared after upgrade to Unreal 4.17.2.