How to fix undefined reference to an existing function?

Hello! Relatively recently implemented in c++. Trying to compile
it
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <rhvoice core engine.hpp>
#include <rhvoice core document.hpp>
#include <rhvoice core client.hpp>
#include <rhvoice rhvoice.h>
#include <rhvoice rhvoice_common.h>

using namespace std;
using namespace RHVoice;

int main(int argc, char **argv){
 RHVoice_init_params tts_params;
 RHVoice_tts_engine tts = RHVoice_new_tts_engine(&tts_params);
 cout << RHVoice_get_voices(tts) << endl;
 return 0;
}</rhvoice></rhvoice></rhvoice></rhvoice></rhvoice></iostream></stdio.h></stdlib.h>


Team
g++ -I/usr/local/include/utf8 -I/usr/local/include/rapidxml -I/usr/local/include/RHVoice -I/usr/local/include -o main main.cpp

But there is a bug
/tmp/ccAMF2oc.o: In function `main':
main.cpp:(.text+0x17): undefined reference to `RHVoice_new_tts_engine'
main.cpp:(.text+0x27): undefined reference to `RHVoice_get_voices'
collect2: error: ld returned 1 exit status

What flags you need to specify g++ in order to make it work?
Thank you in advance!
June 3rd 19 at 19:08
1 answer
June 3rd 19 at 19:10
Solution

... g++- I/usr/local/include/RHVoice ...
main.cpp:(.text+0x17): undefined reference to `RHVoice_new_tts_engine'
main.cpp:(.text+0x27): undefined reference to `RHVoice_get_voices'

Judging by the path to the directory with the headers you want to add something: -L/usr/local/lib -lRHVoice. To find out, you need to look where established and the name of the library (*.a or *.so) RHVoice.
Thanks, helped! - birdie_Reilly commented on June 3rd 19 at 19:13

Find more questions by tags C++G++