I recently downloaded vs code in my m1 mac after downloading the g++ compiler in the terminal and then I downloaded the extensions C/C++ IntelliSence and Code Runner. After doing that I wrote a simple Hello World program but it threw me an error.
Code:
#include<iostream>
using namespace std;
void main()
{
cout<<"Hello World";
}
Output:
[Running] cd "/Users/mohammedalif/HelloWorld/" && g++ main.cpp -o main &&
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Done] exited with code=1 in 0.22 seconds
This is the screenshot of the output I got along with the code
This is what i am getting instead of a simple Hello World output.
What should I do to fix this???