main.c code:
Code: Select all
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "sdkconfig.h"
#include "esp_heap_caps.h"
#include "esp_log.h"
#include "../components/components.h"
void app_main(void)
{
uint8_t x = 3, y = 4, z = 0;
z = sumq(x, y);
while(1);
}
components.h code:
Code: Select all
#ifndef __temp_H__
#define __temp_H__
#include <stdio.h>
uint8_t sumq(uint8_t s1, uint8_t s2);
#endif
components.c code:
Code: Select all
#include "sdkconfig.h"
#include "components.h"
uint8_t sumq(uint8_t s1, uint8_t s2)
{
return s1 + s2;
}
the project structure below (img1)
and the error is as below (img2)
then I moved the function(sumq) definition and prototype to main.c file and it compiled, but they didn't compile in the components.h/.c files. Looks like it's a linker problem
can you help me solve this problem?
Thanks.