[ros-users] Include convention for ROS messages, etc.

Rob Wheeler wheeler at willowgarage.com
Wed Aug 25 17:11:12 UTC 2010


Both work.  The angle brackets are preferable because this is a "system"
include file specified with the -I option to the compiler.  From the gcc
documentation:

2.1 Include Syntax

Both user and system header files are included using the preprocessing
directive `#include'. It has two variants:
#include <file>This variant is used for system header files. It searches for
a file named file in a standard list of system directories. You can prepend
directories to this list with the -I option (see
Invocation<http://gcc.gnu.org/onlinedocs/cpp/Invocation.html#Invocation>).

#include "file"This variant is used for header files of your own program. It
searches for a file named file first in the directory containing the current
file, then in the quote directories and then the same directories used for <
file>. You can prepend directories to the list of quote directories with the
-iquote option.

On Wed, Aug 25, 2010 at 9:50 AM, Joel Cartwright <J.J.Cartwright at hw.ac.uk>wrote:

> Hello all,
>
> I have a question about ROS C++ include convention: For header files
> from another package, which include method is preferable?
>
>        #include <geometry_msgs/Twist.h>
>
> or
>        #include "geometry_msgs/Twist.h"
>
> Both compile correctly, and both are seen in the standard ROS stacks.
>
> Joel
> --
> Research Assistant
> Ocean Systems Laboratory
> Heriot-Watt University, UK
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100825/d671a7e7/attachment-0003.html>


More information about the ros-users mailing list