# Electric compile error in code that compiles with Diamondback: "rospack.h:195: error: ‘rospack_tinyxml’ has not been declared"

When compiling some packges that compile on diamondback I get the following set of compile errors:

  In file included from /home/somervil/Projects/rdk2project/stacks/re2rosUtil/re2_ros_util/include/re2_ros_util/Factory.h:30,
from /home/somervil/Projects/rdk2project/stacks/re2arm/re2_arm_driver/src/driver_common/Driver.cpp:27:
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:195: error: ‘rospack_tinyxml’ has not been declared
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:195: error: ISO C++ forbids declaration of ‘TiXmlElement’ with no type
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:195: error: expected ‘;’ before ‘*’ token
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:210: error: ‘rospack_tinyxml’ has not been declared
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:210: error: ISO C++ forbids declaration of ‘TiXmlDocument’ with no type
/opt/ros/electric/ros/tools/rospack/include/rospack/rospack.h:210: error: expected ‘;’ before ‘manifest’


I'll be answering this shortly myself. I'm just asking it for posterity, and to provide the solution to others.

edit retag close merge delete

Sort by » oldest newest most voted

The problem is a conflicting include guard, TINYXML_INCLUDED, in rospack's custom tinyxml installation.

This has conflicted with other TINYXML implementations even in previous versions of ROS. This mostly went unnoticed because the implementations were compatible enough not to cause compile errors.

In electric tinyxml has been pushed into a namespace: "rospack_tinyxml" So now the conflict is exposed because either the types within the namespace will not be defined, or the types outside the namespace will not be defined depending on the include order.

There is a bug report here:

...so it may be soon fixed but in the mean time a work around would be:

just before an identified offending include file place:

#undef TINYXML_INCLUDED

more