Search code examples
c++cmakecompiler-errorsdata-distribution-service

Compiling Code with CMAKE written with C++ and DDS


I am new to using CMAKE and I am writing a Cmakelists.txt file to compile my project. I get the following error:

/usr/bin/ld: /home/tarun/rti_connext_dds-6.0.0/lib/x64Linux3gcc5.4.0/libnddsc.so: undefined reference to symbol 'PRESTypePlugin_interpretedSerialize'

/home/tarun/rti_connext_dds-6.0.0/lib/x64Linux3gcc5.4.0/libnddscore.so: error adding symbols: DSO missing from command line

I have tried other solutions already available like adding LFLAGS and CFLAGS but I still get the same error.

This is how I am linking my libraries in cmakelists

target_link_libraries(test_IMU_DDS PUBLIC
${CONNEXTDDS_CPP2_API_LIBRARIES_RELEASE_SHARED}
${CONNEXTDDS_EXTERNAL_LIBS} 
${COMMANDTYPE_OBJS}
${PROJECT_SOURCE_DIR}/xspublic/xscommon
${PROJECT_SOURCE_DIR}/xspublic/xscontroller
${PROJECT_SOURCE_DIR}/xspublic/xstypes
${CMAKE_DL_LIBS}
)

Will anyone be able to help me out with this?


Solution

  • There is an example about how to build a ConnextDDS application in their community GitHub profile: Build a ConnextDDS application with CMake

    That example is using the files from the "resources/cmake" folder (to call RTI Code Generator and a FindPackage CMake script). The FindPackage script is also provided with the ConnextDDS installation (6.0.0) but the one from the community is more updated. The FindPackage script will provide you with all the definitions, flags and libraries you need in order to integrate ConnextDDS in your project.