During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deeply

Typically: "How do I... ", "How can I... " questions
Post Reply
Smitty44
Posts: 37
Joined: 20 Mar 2019, 16:50
Location: East coast, US.

During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deeply

Post by Smitty44 » 21 Mar 2020, 16:27

Hi there.
While compiling the sim_ros_interface for Windows, I received the C1061: compiler limit exceeded error for nested blocks.
Since that code is generated for us, does anyone have any idea what I can do to get past this?
Those files are composed of just nested ELSE IF statements like the following:
else if(publisherProxy->topicType == "tf2_msgs/TF2Error")
{
tf2_msgs::TF2Error msg;
read__tf2_msgs__TF2Error(p->stackID, &msg, &(publisherProxy->rd_opt));
publisherProxy->publisher.publish(msg);
}

IF I knew what was actually calling this generated pub.cpp file, I might be able to know how to modify it.
Also, there are two other files like this one with long nested blocks, namely adv.cpp and sub.cpp.
I also know this is a hard limit for the MSVC compiler.
Thanks for any help in advance.

Smitty44
Posts: 37
Joined: 20 Mar 2019, 16:50
Location: East coast, US.

Re: During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deep

Post by Smitty44 » 21 Mar 2020, 20:44

Ok, it took some poking around but I think sub.cpp, pub.cpp and adv.cpp get called in ...myworkspace\src\sim_ros_interface\src\sim_ros_interface.cpp. (lines 86, 134, and 184)

So, would it be possible for me to break each one of those files into two?
Say, sub1.cpp and sub2.cpp. Then, change the include statement to:

#include <pub1.cpp>
#include <pub2.cpp>


OR
repeat the if/else statement?... like this:

void publish(...)
{
if(0) {}
#include <pub1.cpp>
else
{
throw exception("unsupported message type. please edit and recompile ROS plugin");
}
if(0) {}
#include <pub2.cpp>
else
{
throw exception("unsupported message type. please edit and recompile ROS plugin");
}
}


Any thoughts?

fferri
Posts: 556
Joined: 09 Sep 2013, 19:28

Re: During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deep

Post by fferri » 23 Mar 2020, 10:13

Hi,

the templates for the generated files are in simExtROSInterface/templates/. Simply modify those and recompile.

Smitty44
Posts: 37
Joined: 20 Mar 2019, 16:50
Location: East coast, US.

Re: During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deep

Post by Smitty44 » 23 Mar 2020, 17:21

Thank you for your response.
This nesting limit on Windows, was the focus of why I couldn't get the compile of simExtROSInterface to actually work.
I wasn't sure what to change in the template.
It was a little beyond my coding skills.

So, my fix was to actually alter the "if else" statements inside of sim_ros_interface.cpp.
I know its not the most elegant solution by far, but after successfully recompiling, I launched the Sim and I am now progressing further thru the ROS1 tutorial. https://www.coppeliarobotics.com/helpFi ... torial.htm

I've been able to go from the beginning to:
rostopic echo /simulationTime
I loaded the rosInterfaceTopicPublisherAndSubscriber.ttt
and that appears to be working.
when I type in:
> rosrun image_view image_view image:=/visionSensorData
a small window opens labeled /visionSensorData opens but nothing is shown.
If I click on the window, it shows (Not responding).
But as I progress through the rest of the ROS1 tutorial, everything else is working.

fferri
Posts: 556
Joined: 09 Sep 2013, 19:28

Re: During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deep

Post by fferri » 23 Mar 2020, 18:19

Smitty44 wrote:
23 Mar 2020, 17:21
when I type in:
> rosrun image_view image_view image:=/visionSensorData
a small window opens labeled /visionSensorData opens but nothing is shown.
If I click on the window, it shows (Not responding).
image_view is not part of CoppeliaSim's ROS interface.

That might be an issue with image_view and Windows. Did you check on the ROS Q&A forum? Or in the ROS bugtracker?

Smitty44
Posts: 37
Joined: 20 Mar 2019, 16:50
Location: East coast, US.

Re: During build: ...sim_ros_interface\generated\pub.cpp(728): fatal error C1061: compiler limit: blocks nested too deep

Post by Smitty44 » 23 Mar 2020, 18:24

Oh ok. I haven't tried the ROS forums or bugtracker yet.
Thank you for the heads up!
And thank you for the quick responses.

Post Reply