Неопределенная ссылка на функцию разговора
После ввода make
чтобы скомпилировать проект, который зависит от espeak я получил следующую ошибку на этапе компоновки
`EspeakTTSWorker.cpp:(.text+0x118): undefined reference to `espeak_Initialize'
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o: In function `EspeakBridge::init()':
EspeakBridge.cpp:(.text+0x93): undefined reference to `espeak_Initialize'
EspeakBridge.cpp:(.text+0x9d): undefined reference to `espeak_SetVoiceByName'
EspeakBridge.cpp:(.text+0xa7): undefined reference to `espeak_SetSynthCallback'
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o: In function `EspeakBridge::close()':
EspeakBridge.cpp:(.text+0x173): undefined reference to `espeak_Terminate'
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o: In function `EspeakTTSWorker::setText(std::string const&)':
EspeakBridge.cpp:(.text._ZN15EspeakTTSWorker7setTextERKSs[_ZN15EspeakTTSWorker7setTextERKSs]+0x121): undefined reference to `espeak_Synth'
EspeakBridge.cpp:(.text._ZN15EspeakTTSWorker7setTextERKSs[_ZN15EspeakTTSWorker7setTextERKSs]+0x126): undefined reference to `espeak_Synchronize'
collect2: error: ld returned 1 exit status
make[2]: *** [TextReading] Error 1
make[1]: *** [CMakeFiles/TextReading.dir/all] Error 2
make: *** [all] Error 2`
а вот чмакелисиц
find_package (Espeak)
if (Espeak_FOUND)
include_directories(${Espeak_INCLUDE_DIRS}) #/usr/local/include/espeak
endif(Espeak_FOUND)
if (NOT Espeak_Found)
message(FATAL_ERROR "Package Espeak required, but not found!")
endif(NOT Espeak_Found)
add_executable(TextReading
${DAD_SOURCES}
${DAD_HEADERS}
${MY_UI_HDRS}
${MY_MOC_SRCS}
${MY_CUDA_COMPILED_FILES}
${QEXTSERIALPORT_SOURCES} ${QEXTSERIALPORT_HEADERS}
)
target_link_libraries(TextReading
${OpenGL_LIBS}
${QT_LIBRARIES}
${QGLVIEWER}
${Boost}
${OpenCV_LIBS}
${TESSERACT_LIB}
${FFMPEG_LIBRARIES}
${MathGL_LIB}
# ${Flite_LIBS}
${Espeak_LIBRARIES}
#/usr/lib/x86_64-linux-gnu/libespeak.so.1
#/usr/lib/x86_64-linux-gnu/libespeak.so.1.1.47
${QEXTSERIALPORT_LIBS}
${QTMOBILITY_LIBRARIES}
udev
)
подсказка: я положил FindEspeak.cmake
файл в пути модуля cmake
1 ответ
Решение
Я только что отредактировал эту часть
############ Find ESPEAK TTS ############
find_path(LIBESPEAK_INCLUDE_DIRS
NAMES speak_lib.h
HINTS /usr/include/espeak)
find_library(LIBESPEAK_LIBRARIES
NAMES espeak
HINTS /usr/lib/ /usr/x86_64-linux-gnu/
PATH_SUFFIXES lib)
########################################
add_executable(TextReading
${DAD_SOURCES}
${DAD_HEADERS}
${MY_UI_HDRS}
${MY_MOC_SRCS}
${MY_CUDA_COMPILED_FILES}
${QEXTSERIALPORT_SOURCES} ${QEXTSERIALPORT_HEADERS}
)
target_link_libraries(TextReading
${OpenGL_LIBS}
${QT_LIBRARIES}
${QGLVIEWER}
${Boost}
${OpenCV_LIBS}
${TESSERACT_LIB}
${FFMPEG_LIBRARIES}
${MathGL_LIB}
#${ESPEAK_LIBRARIES}
${LIBESPEAK_LIBRARIES}
${QEXTSERIALPORT_LIBS}
${QTMOBILITY_LIBRARIES}
udev
)