Не удается открыть файл: ../sysdeps/posix/system.c

Я пытаюсь передать некоторые строки espeak и он скажет им по этому коду:

#include <string.h>
#include <malloc.h>
#include <espeak/speak_lib.h>
#include <iostream>

#include <stdlib.h>
#include <unistd.h>
//#include <cstring>
using namespace std;
int main()
{espeak_POSITION_TYPE position_type;
espeak_AUDIO_OUTPUT output;
char *path=NULL;
int Buflength = 500, Options=0;
void* user_data;
t_espeak_callback *SynthCallback;
espeak_PARAMETER Parm;char Voice[] = {"English"};

int i=0;

char text[11][200] {"hi ",
"This is...",
"you can ... ",
"I am ,,,, " ,
"you can ... ",
"hope you ... ",
"come in ... ",
"if you ... ",
"you will... ",
"I hope ... ",
"Take care "};unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier;output = AUDIO_OUTPUT_PLAYBACK;

espeak_Initialize(output, Buflength, path, Options );
espeak_SetVoiceByName(Voice);
const char *langNativeString = "en_US";
espeak_VOICE voice= {0};

voice.languages = langNativeString;
voice.name = "US";
voice.variant = 2;
voice.gender = 1;
//  Size = strlen(text)+1;for (;;)
{for(i=0; i<11; i++)
{
Size = sizeof(text[i]);
system("eog --fullscreen --disable-gallery --single-window 1.jpg &");
usleep(3000000);

espeak_Synth( text[i], Size, position, position_type, end_position, flags,
unique_identifier, user_data );
espeak_Synchronize( );
system("eog --fullscreen --disable-gallery --single-window 1.jpg &");
usleep(3000000);

}
//fflush(stdout);

}

return 0;
}

Но я получаю segmentation fault(core dumped) ошибка. Я попытался отладить код, и это ошибка: Cannot open file: ../sysdeps/posix/system.c что происходит в этой строке кода:
system("eog --fullscreen --disable-gallery --single-window 1.jpg &");
, Как я могу это исправить?

0

Решение

Вы считать иметь 11 массивов (предложений), но у вас есть только 10.
Эти двое

          "I am glad too meet you here ""you can see many science and technology products here ",

на самом деле только один, так как вы пропустите запятую в конце

2

Другие решения

Я перенес эту часть кода за пределы main() функция, и теперь она работает без ошибок:

espeak_POSITION_TYPE position_type;
espeak_AUDIO_OUTPUT output;
char *path=NULL;
int Buflength = 500, Options=0;
void* user_data;
t_espeak_callback *SynthCallback;
espeak_PARAMETER Parm;char Voice[] = {"English"};

int i=0;
unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier;
0

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector