I wrote a program that in the main function calls a function from another .c file, but outputs an error undefined reference to 'function_name'. collect2: error: ld returned 1 exit status. I compile the program on the Linux command line: gcc -o main.exe main.c ./main.exe
funcs.h
#ifndef FUNCS_H_INCLUDED
#define FUNCS_H_INCLUDED
int foo();
#endif
second.c
#include <stdio.h>
#include "funcs.h"
int foo(){
printf("Hello, world!");
return 0;
}
main.c
#include <stdio.h>
#include "funcs.h"
int foo();
int main(){
foo();
return 0;
}
how to fix the error