Syntax Error in TopicDataType.hpp When Generating SWIG Bindings for Fast DDS #103
Unanswered
Jackie2chen
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello, can you please provide all the necessary files to reproduce the error? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am working with Fast DDS and attempting to generate Python bindings using SWIG version 4.2.1. However, I've run into a syntax error that seems to be related to the
TopicDataType.hpp
file.Here's the error message I'm encountering:
TopicDataType.hpp:71: Error: Syntax error - possibly a missing semicolon (';')
fastcdr veriosn:2.0.0
fastrtps 2.12.0
swig 4.2.1
`find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
if(${SWIG_VERSION} VERSION_GREATER_EQUAL 4)
list(APPEND CMAKE_SWIG_FLAGS "-doxygen")
endif()
if(UNIX AND NOT APPLE)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE64")
else()
list(APPEND CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE32")
endif()
endif()
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS})
list(APPEND CMAKE_SWIG_FLAGS "-DPY3")
指定IDL文件的位置
set(IDL_DIR "../idl")
指定生成的Python模块名称
set(MODULE_NAME "idl_python")
set(IDL_FILES
"${IDL_DIR}/unit_test.i"
"${IDL_DIR}/sim_time.i"
"${IDL_DIR}/basestructure.i"
"${IDL_DIR}/unit_testPubSubTypes.i"
"${IDL_DIR}/sim_timePubSubTypes.i"
"${IDL_DIR}/basestructurePubSubTypes.i"
)
set(CMAKE_CXX_STANDARD 17)
foreach(IDL_FILE ${IDL_FILES})
get_filename_component(MODULE_FILE_NAME ${IDL_FILE} NAME_WE)
set_source_files_properties(${IDL_FILE} PROPERTIES CPLUSPLUS ON
USE_TARGET_INCLUDE_DIRECTORIES TRUE)
swig_add_library(${MODULE_FILE_NAME}c
TYPE SHARED
LANGUAGE python
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/" # 指定输出目录
SOURCES ${IDL_FILE})
swig_link_libraries(${MODULE_FILE_NAME}c ${Python3_LIBRARIES} fastrtps ${TARGET_NAME})
endforeach()`
Beta Was this translation helpful? Give feedback.
All reactions