1
votes
#include <unistd.h>
void    ft_print_alphabet(void)
{
    write(1, 
 "abcdefghijklmnopqrstuvwxyz", 26);
}

I tried running the above in VS Code and I got the following error:

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)

1
What does your books, class-notes or tutorials say about C programs and where it starts execution? Perhaps you need to go back to the very beginning of your books (or get some books to read).Some programmer dude

1 Answers

0
votes

You need to define the main method, something like:

int main(int argCount, char *args[]) {
    // Your App's main-thread loop here...
    return 0;
}

Note that the name, return-type and arguments are all part of a predefined signature, which is searched for and executed the moment someone runs the App.

But remember that a GUI app may have a somewhat different signature (at least that is the case for Windows).