Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 69

How do I include the header?

$
0
0
I am currently having some problem including header within my catkin_package. This is the file structure: pkg_a/ ├── CMakeLists.txt ├── CMakeLists.txt.user ├── include │ └── pkg_a │ ├── pugiconfig.hpp │ └── pugixml.hpp ├── package.xml ├── src ├── src.cpp ├── header_to_src.h ├── node.cpp ├── pugixml.cpp ├── src_2.cpp └── header_to_src_2.h I am trying to include pugixml.hpp in the cpp. file. The way i've tried to do it is like this #include But it cannot find it.. What is the path to it.. I would like to avoid making direct path to the include folder, such that other packages also easily can enter include the .hpp file. This is the CMakeList cmake_minimum_required(VERSION 2.8.3) project(pkg_a) #Compiler flags add_definitions(-std=c++1y) find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg message_generation depend_1 depend_2 ) catkin_package( INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME} CATKIN_DEPENDS DEPENDS system_lib ) include_directories( include ${catkin_INCLUDE_DIRS} ) ## Mark cpp header files for installation install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN ".svn" EXCLUDE ) ## Mark other files for installation (e.g. launch and bag files, etc.) install( DIRECTORY include/${PROJECT_NAME}/ # # myfile1 # # myfile2 DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) SET(SRC_FILES ${SRC_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/src/src.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/src_2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.cpp # ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp CACHE INTERNAL "" ) add_library(${PROJECT_NAME} ${SRC_FILES}) add_executable(run_${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/src/node.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.cpp) add_dependencies( ${PROJECT_NAME} depend_1_generate_messages_cpp depend_2_generate_message_cpp ) target_link_libraries(run_${PROJECT_NAME} ${PROJECT_NAME} ${catkin_LIBRARIES} )

Viewing all articles
Browse latest Browse all 69

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>