Error in vscode: "ros/ros.h"- No such file or directory
Hi all, i am new in ROS and am trying to setup my vscode environment for ROS. I searched a lot for the right answer but could not solve my problem. I inlcuded all important lines in my CMakeList but the error is still not gone, so i am clearly missing something. I am using melodic 1.14.10 on Ubuntu.
Here is my CMakeList:
cmake_minimum_required(VERSION 3.0.2)
project(hello)
find_package(catkin REQUIRED COMPONENTS
nav_msgs
roscpp
rospy
sensor_msgs
std_msgs
geometry_msgs
message_filters
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES hello
CATKIN_DEPENDS nav_msgs roscpp rospy sensor_msgs std_msgs geometry_msgs message_filters
DEPENDS system_lib
)
include_directories(
#include/hello
${catkin_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME}
src/ekf.cpp
)
## add_executable(EKF src/main.cpp)
add_executable(EKF src/main.cpp src/ekf.cpp)
target_link_libraries(EKF ${catkin_LIBRARIES})
My tasks.json:
{
"tasks": [
{
"type": "shell",
"label": "C/C++: cpp Aktive Datei kompilieren",
"command": "/usr/bin/cpp",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Vom Debugger generierte Aufgabe."
}
],
"version": "2.0.0"
}
My simple header file with the #include ros/ros.h causing the problem:
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <sensor_msgs/LaserScan.h>
#include <nav_msgs/Odometry.h>
#include "tf/tf.h"
#include <geometry_msgs/Twist.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
class EKF{
public:
vector<double> landmarks;
int count;
vector<double> readFile(ros::NodeHandle nh);
};
I could not attach a screenshot to show the error, but it says exactly the this line:
"ros/ros.h"- No such file or directory
I really appreciate your support.