ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem compiling node with Geany

asked 2020-03-02 05:02:27 -0500

Yadav gravatar image

updated 2020-03-03 01:51:22 -0500

mgruhler gravatar image

Hello everyone when i compile my Node;cpp file it points me towards an error in Node.h file And the error it shows is

Node.h : fatal error: ros/ros.h : No file or folder of this type

I have looked into previous questions asked on this topic, so my file "package.xml" and "CmakeLists.txt" for this node seems correct to me, though i am posting them

package.xml

<?xml version="1.0"?>
<package>
  <name>p_sedimentation_estimator</name>
  <version>0.0.0</version>
  <description>Fusion of pointcloud sonar and scan laser</description>

  <maintainer email="ro@rob.com">Rob</maintainer>
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>cana_msgs</build_depend>

  <!-- todo -->

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

Cmakelists.txt

cmake_minimum_required(VERSION 2.8.12)
project(p_sedimentation_estimator)

add_definitions(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED
    roscpp
    std_msgs
    geometry_msgs
    pcl_conversions
    pcl_ros
    tf2_ros
    tf2_bullet
    cana_msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES p_sedimentation_estimator
#  CATKIN_DEPENDS other_catkin_pkg
#  DEPENDS system_lib
)

find_package(OpenCV REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core)
find_package(Boost 1.54.0 REQUIRED COMPONENTS )


###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
    ${catkin_INCLUDE_DIRS}
)

file(GLOB Node_SRC
    "src/*.h"
    "src/*.cpp"
)

## Declare a C++ executable
add_executable(p_sedimentation_estimator ${Node_SRC})

## Specify libraries to link a library or executable target against
target_link_libraries(p_sedimentation_estimator
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
  Qt5::Core
)

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executables and/or libraries for installation
install(TARGETS p_sedimentation_estimator p_sedimentation_estimator
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

WHAT or Where could be the problem ??

1)catkin_make runs without error

2)Compilation of the node.cpp program gives this error(Node.h : fatal error: ros/ros.h : No file or folder of this type) in node.h file

3) is it necesarry to use build also , other than sourcing, catkin_make and compiling.

Help Needed :) Thanku in advance :)

edit retag flag offensive close merge delete

Comments

Could I ask you to please format your questions properly? I've done it for you now (and in your previous questions as well), but for next time: select any code/console text/etc and press ctrl+k or click the Preformatted Text button (the one with 101010 on it).

gvdhoorn gravatar image gvdhoorn  ( 2020-03-02 06:04:31 -0500 )edit

@gvdhoorn Thanku so much...i will keep it in mind next time :)

Yadav gravatar image Yadav  ( 2020-03-02 06:38:16 -0500 )edit

@Yadav If I understand your question correctly, at the end you specify three points 1), 2), 3) that you step through, right?

Could you please explain how you "compile" your node? Because this is actually what catkin_make will do for you and thus I don't think you can have 1) successfull and 2) not if you are using the standard workflow...

mgruhler gravatar image mgruhler  ( 2020-03-02 08:01:50 -0500 )edit

@mgruhler Yes,catkin_make runs without error But when i compile the code in the Node.cpp file alone, using "Geany" it shows me the error(Node.h : fatal error: ros/ros.h : No file or folder of this type) in node.h file So by catkin_make it gets compiled but it doen't work according to the code in Node.cpp file

Standard workflow ?

Yadav gravatar image Yadav  ( 2020-03-02 08:52:10 -0500 )edit
2

@Yadav then you don't have a problem with compiling your code in general, but only using geany. I've retagged and reworded your question title as such.

mgruhler gravatar image mgruhler  ( 2020-03-03 01:51:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-03-03 01:58:50 -0500

mgruhler gravatar image

As ROS and caktin heavily builds on CMake as a build system, you at least need an IDE that supports it. Even though it is stated that Geany can use CMake, I haven't found a way to properly configure it with a few minutes of search. You might have to use some plugins.

This is even more true that ROS also requires a few more quirks to set up, usually. There is a large list of IDEs and how to use them with ROS on the wiki. I suggest you try one of those if you want to compile from source. If you want more fancy stuff like jumping to external (out of your source) function definitions, those instructions might come in handy.

On another note: you tagged your question with Indigo. Indigo is EOL since for almost a year now, I suggest to update to a new one

edit flag offensive delete link more

Comments

I could suggest to not use GEANY also :) Thanks @mgruhler @gvdhoom for the help :)

Yadav gravatar image Yadav  ( 2020-03-10 05:27:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-02 05:02:27 -0500

Seen: 370 times

Last updated: Mar 10 '20