本质上就是预处理阶段对include进行复制
.h文件
#ifndef PRINT123_H
#define PRINT123_H#include <stdio.h>
void print123()
{
printf("Hello, world!454434\n");
}#endif
cmake文件
add_executable(test src/test.cpp)
add_dependencies(test ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(test ${catkin_LIBRARIES})
test.cpp
#include "print123.h"
int main()
{
print123();
printf("1111!\n");
return 0;
}