当我编译下面的程序时,它给了我这个错误.
/tmp/ccwr6gsJ.o: In function 'main':
main.cL(.text+0xa): undefined reference to 'example'
collect2: error: Id returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
MAIN.C:
#include <stdio.h>
#include "includes.h"
int main()
{
int exampleInt = example();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
INCLUDES.H:
int example();
Run Code Online (Sandbox Code Playgroud)
includes.c:
#include "includes.h"
int example()
{
int i = 3;
return i;
}
Run Code Online (Sandbox Code Playgroud)
它似乎适用于Visual Studio,但不适用于Linux上的GCC