0

I am creating a sound recognition program and there is a syntax error I can't solve in C++ here it is:

sRecognize->SpeechRecognized += sRecognize_SpeechRecognized;

The error says:

Error 1 error C3867: 'SoundRecognizer::MyForm::sRecognize_SpeechRecognized': function call missing argument list; use '&SoundRecognizer::MyForm::sRecognize_SpeechRecognized' to create a pointer to member d:\c++\studio\testing\soundrecognizer\soundrecognizer\MyForm.h 114 1 SoundRecognizer

The function sRecognize_SpeechRecognized:

private :  
void sRecognize_SpeechRecognized(Object^ sender, SpeechRecognizedEventArgs^e)
{                   
    if (e->Result->Text == "exit")
    {
        Application::Exit();
    }
    else
    {
        textBox1->Text = textBox1->Text + " " + e->Result->Text->ToString();
    }       
}
Anton K
  • 4,658
  • 2
  • 47
  • 60
Bakr
  • 9
  • 1
  • did you try to write as compiler says: &SoundRecognizer::MyForm::sRecognize_SpeechRecognized instead of sRecognize_SpeechRecognized ? – Nikita Aug 26 '14 at 11:48
  • Yes I have, it still doesn't work. – Bakr Aug 26 '14 at 11:50
  • Did you try to use operator = instead of += ? What is SpeechRecognized? – Nikita Aug 26 '14 at 11:53
  • 2
    That is C# syntax, you must use C++/CLI syntax. Like the error message says. Just press the Tab key to let the editor autocomplete the assignment to `sRecognize->SpeechRecognized += gcnew EventHandler(this, &MyForm::sRecognize_SpeechRecognized);` – Hans Passant Aug 26 '14 at 12:06

0 Answers0