How to rosmake project with c and cpp?
Hi all,
I am making a project with c and cpp involved. For example, in the src folder I have:
a.h a.cpp -- main function
b.h b.c -- some utility functions
How can I modified the CMakeList.txt to make it work? I get errors saying that a.cpp has undefined reference to some functions, which are defined in b.c, while I already include b.h in a.h. My current CMakeList.txt looks like this.
rosbuild_add_library(mylib src/b.c)
rosbuild_add_executable(mymain src/a.cpp)
target_link_libraries(mymain mylib)
I have not solved the problem with ROS rosmake yet. But I add the following lines in a makefile and use nomal make command and it works.
# The pre-processor options used by the cpp (man cpp for more).
CPPFLAGS = -Wall -I/opt/ros/fuerte/include/
# The options used in linking as well as in any direct use of ld.
LDFLAGS = -L/opt/ros/fuerte/lib/ -lopencv_core -lopencv_imgproc -lopencv_highgui
those 3 cmake lines look OK