In macOS With Visual Studio Code, I tried to compile C source code. (There are 3 parts of source code bellow)
head.h(edited)
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int add_number(int a, int b);
body.c
#include "head.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int add_number(int a, int b)
{
    return a + b;
}
main.c
#include "head.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
    int result = add_number (1, 2);
    printf("%d", result);
    return 0;
}
AND
gcc main.c
However, when I pushed F5 to compile this c code, following error occured:
Undefined symbols for architecture x86_64:
  "_add_number", referenced from:
      _main in main-49215f.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is it link fail messages? Is anyone help me to fix this errors? for example, vsc setting or ...
P.S. my vsc's tasks.json is as bellow:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "gcc build",
            "command": "/usr/bin/gcc",
            "args": [
                "-g",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "${file}"
            ],
            "options": {
                "cwd": "/usr/bin"
            },
            "problemMatcher": 
            { 
                "fileLocation": [ 
                "relative", "${workspaceRoot}" 
                ], 
                "pattern": 
                { 
                    // The regular expression. 
                    //Example to match: helloWorld.c:5:3: warning: implicit declaration of function 'prinft' 
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$", 
                    "file": 1, 
                    "line": 2, 
                    "column": 3, 
                    "severity": 4, 
                    "message": 5 
                }
            },
        "group": "build"
        },
    {
        "label": "execute", 
        "command": "cd ${fileDirname} && ./${fileBasenameNoExtension}", 
        "group": "test"
    }
]
}
 
    