Abhishek Thayyil
Abhishek Thayyil

Reputation: 91

Signal function error

I am new to C++, in my main method am facing with an error in signal function. When i build the application output comes which is error C3861: 'signal': identifier not found.

int main(array<System::String ^> ^args)
{
 signal(SIGINT, signal_callback_handler);
 signal(SIGTERM, signal_callback_handler);
}

Thanks.

Upvotes: 0

Views: 397

Answers (2)

Chen
Chen

Reputation: 1672

If you already #include <signal.h>, the error cause might be your project is compiled with /clr:pure. You cannot call signal() in a pure CLR project.

You can fix it by changing /clr:pure to /clr:

  1. Open Project property page.
  2. Change the setting in: Configuration Properties -> C/C++ -> All Options -> Common Language RunTime Support.

Upvotes: 1

Klas Lindb&#228;ck
Klas Lindb&#228;ck

Reputation: 33273

The C include file may lack extern C { around the declaration. Since this is C++ you might be better off including <csignal> than <signal.h>.

#include <csignal>

Upvotes: 0

Related Questions