esp32 can not use sigaction function
Posted: Mon Jun 06, 2022 3:34 pm
the code is below ,but when I use sigaction function, the compile was failed, it said
"undefined reference to `sigaction", but I have already include the signal.h , so what's the problem? Thanks very much!
...
...
#include "esp_system.h"
#include <pthread.h>
#include "esp_spi_flash.h"
#include "signal.h"
void app_main(void)
{
int i;
pthread_t thrid_sx1302;
printf("Hello world!\n");
struct sigaction sigact;
sigaction(SIGQUIT, &sigact, NULL); /* Ctrl-\ */
sigaction(SIGINT, &sigact, NULL); /* Ctrl-C */
sigaction(SIGTERM, &sigact, NULL); /* default "kill" command */
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
...
...
}
"undefined reference to `sigaction", but I have already include the signal.h , so what's the problem? Thanks very much!
...
...
#include "esp_system.h"
#include <pthread.h>
#include "esp_spi_flash.h"
#include "signal.h"
void app_main(void)
{
int i;
pthread_t thrid_sx1302;
printf("Hello world!\n");
struct sigaction sigact;
sigaction(SIGQUIT, &sigact, NULL); /* Ctrl-\ */
sigaction(SIGINT, &sigact, NULL); /* Ctrl-C */
sigaction(SIGTERM, &sigact, NULL); /* default "kill" command */
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
...
...
}