How to invoke function from external .c file in C?
Change your Main.c
like so
#include <stdlib.h>
#include <stdio.h>
#include "ClasseAusiliaria.h"
int main(void)
{
int risultato;
risultato = addizione(5,6);
printf("%d\n",risultato);
}
Create ClasseAusiliaria.h
like so
extern int addizione(int a, int b);
I then compiled and ran your code, I got an output of
11
Use double quotes #include "ClasseAusiliaria.c"
[Don't use angle brackets (< >
) ]
And I prefer to save the file with .h
extension In the same directory/folder.
TLDR:
Replace #include <ClasseAusiliaria.c>
with
#include "ClasseAusiliaria.c"