Problem compiling .cpp program with gcc
Hi all,
I would like to compile a .cpp (main.cpp) program with my MacBook Air M1, with gcc, with the command:
gcc main.cpp
But, even with an "hello world" program I am not able to do that for this error (complete error log in the file):
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What I've noticed is that if I try to compile a .c program it doesn't give me an error and everything goes well.
Details about gcc version:
gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I don't know what to do. It would be great if someone will answer me. Thanks in advance.
MacBook Air (2020 or later)