fast-rtps中通过fastrtpsgen
工具将IDL文件
生成C++代码
要使用fastrtpsgen工具首先要安装以下三个库:
1、cd ~/eProsima/src/fastcdr/build
sudo make install
默认安装在/usr/local/lib/libfastcdr.so
2、cd ~/eProsima/src/memory-main/build
sudo make install
默认安装在/usr/local/lib/libfoonathan_memory-0.7.3.a
3、/usr/local/lib/libfastrtps.so
新建testRTPS文件夹:新建HelloWorld.idl
struct HelloWorld
{
string msg;
}
执行fastddsgen工具
java -jar ~/eProsima/src/fastddsgen/share/fastddsgen/java/fastddsgen.jar -ezample CMake ~/testFastRTPS/HelloWorld.idl -d ./src
src目录下产生代码:
HelloWorldCdrAux.ipp HelloWorld.h HelloWorldPublisher.h HelloWorldPublisherTypes.cxx
HelloWorldSubscriber.cxx HelloWorldCdrAux.hpp HelloWorld.cxx HelloWorldPublisher.cxx
HelloWorldPublisherMain.cxx HelloWorldPublisherTypes.h HelloWorldSubscriber.h