Unable to find console.h from ros folder ROS Melodic

asked 2020-01-08 05:28:04 -0600

Hi All,

I have a cpp file with some source code and 2 #includes of ROS

#include "ros/ros.h"
#include "ros/console.h"

I am trying to convert this file to python. I am successfully able to do it, but it is unable to find console.h which is #included. My problem looks similar to a post which is addressed here referred question linked here, which suggests a problem with cmake file. But in contrast with the suggested solution, my cmake also looks fine. It aligns with the suggested solution. But still gives me error. Inside ros folder it has ros.h, console.h.. But it is unable to link. I work on ROS melodic and not kinetic in Ubuntu 18.04. Am I missing on something?


cmake_minimum_required(VERSION 2.8.3)
project( arduino_lib)

find_package(catkin REQUIRED COMPONENTS


  CATKIN_DEPENDS message_runtime




<?xml version="1.0"?>
<package format="2">
  <description>The arduino_lib package</description>

  <maintainer email="drl@todo.todo">drl</maintainer>




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


Goal :

My main aim is to convert a cpp file which has ros included files to python and can be imported as a library.

Error :

>  ImportError: /home/anaconda3/lib/python3.7/site-packages/arduino_lib.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN3ros7console13g_initializedE

I understand from this error that it is unable to find ros-console. But when I check inside my ROS folder, console.h file is present.

Any suggestions on what am I missing is much appreciated.

edit retag flag offensive close merge delete


Not sure if that is the root cause of your problem, but using an alternative python interpreter over the System standard on is highly discouraged. As there is anaconda on your path, this might be the cause of error here. Please try if the works with the apt installed standard python distribution for 18.04.

There are quite a lot of related questions, e.g. #q301850 (though not a full duplicate).

mgruhler gravatar imagemgruhler ( 2020-01-08 06:27:50 -0600 )edit