-1
我對這個project工作,這是一個相關的issue 我已經取代了TTS FLITE與eSpeak文字轉語音引擎引擎,所以我不得不修改的CMakeLists.txt未定義參考espeak的使用cmake
find_package(Espeak REQUIRED)
include_directories(${Espeak_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Espeak_LIBRARIES})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/Modules/")
if (NOT Espeak_Found)
message(FATAL_ERROR "Package Espeak required, but not found!")
endif(NOT Espeak_Found)
因爲默認支持該FindEspeak.cmake isn`t的,所以我說的文件cmake的默認模塊路徑,編譯了該項目,並出現以下錯誤
Linking CXX executable TextReading
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o:(.bss+0x0): multiple definition of `samplerate'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x0): first defined here
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o:(.bss+0x10): multiple definition of `sounddata'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x10): first defined here
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o:(.bss+0x28): multiple definition of `counter'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x28): first defined here
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o:(.bss+0x30): multiple definition of `waves'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x30): first defined here
CMakeFiles/TextReading.dir/EspeakBridge.cpp.o: In function `SynthCallback(short*, int, espeak_EVENT*)':
EspeakBridge.cpp:(.text+0x0): multiple definition of `SynthCallback(short*, int, espeak_EVENT*)'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:EspeakTTSWorker.cpp: (.text+0x0): first defined here
CMakeFiles/TextReading.dir/moc_EspeakTTSWorker.cxx.o:(.bss+0x0): multiple definition of `samplerate'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x0): first defined here
CMakeFiles/TextReading.dir/moc_EspeakTTSWorker.cxx.o:(.bss+0x10): multiple definition of `sounddata'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x10): first defined here
CMakeFiles/TextReading.dir/moc_EspeakTTSWorker.cxx.o:(.bss+0x28): multiple definition of `counter'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x28): first defined here
CMakeFiles/TextReading.dir/moc_EspeakTTSWorker.cxx.o:(.bss+0x30): multiple definition of `waves'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:(.bss+0x30): first defined here
CMakeFiles/TextReading.dir/moc_EspeakTTSWorker.cxx.o: In function `SynthCallback(short*, int, espeak_EVENT*)':
moc_EspeakTTSWorker.cxx:(.text+0x0): multiple definition of `SynthCallback(short*, int, espeak_EVENT*)'
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o:EspeakTTSWorker.cpp:(.text+0x0): first defined here
CMakeFiles/TextReading.dir/EspeakTTSWorker.cpp.o: In function `EspeakTTSWorker::run()':
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`
我應該怎麼辦?
您應該鏈接到espeak的。學習一些CMake,這就是每一個CMake的內容! – usr1234567
我說過我已經編輯了更多搜索後的cmakelists文件。 –