cundefinedinvocation

Undefined symbols for architecture x86_64 VSCode error


I am trying to fix the error in the following C program, that I get in the terminal in VSCode ?

#include <stdio.h>

main()
{
    printf("just one small step for coders.one giant leap for\n");
    printf("programmers\n");
    return 0;
}

Below is the error that I get while compiling in the VSCode terminal:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

  • You are missing the inclues, this code run for me, and if you are doing everything okay it should run for you:

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
        printf("just one small step for coders.one giant leap for\n");
        printf("programmers\n");
        return 0;
    }