I have a factory reset laptop with Mac OS Ventura. I have installed home-brew and then gcc thru brew, now when I try to compile c or c++ code I get an 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
collect2: error: ld returned 1 exit status
the code I am trying to compile is very simple
c file: the command that I used "gcc hi.c -o hi"
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
c++ file: the command that I used "gcc hello.cpp -o hello.cpp"
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}
I tried aliasing with the commands
ln -s gcc-13 gcc ln -s g++-13 g++