Undefined symbols for architecture arm64: while using vs code to run c/c++

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)

This is the error shown, I'm a beginner in C and C++ programming and I don't know what to do I have installed gcc successfully through homebrew and when I run this simple code for printing Hello world in VS code, it is showing this error. I don't know what I should do at this point.

#include <cstdio>

int main(){
    puts("Hello world\n");
return 0;
}

Upvotes: 2

Views: 2759

Answers (1)

MayCrew
MayCrew

Reputation: 41

Perhaps the problem had been solved already. I just encountered this problem yet my homebrew is installed at the right place, and I solved it by typing g++ instead of gcc. Maybe you can give it a try.

Upvotes: 3

Related Questions