Reputation: 91
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
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
:
Configuration Properties
-> C/C++
-> All Options
-> Common Language RunTime Support
.Upvotes: 1
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