I'm doing a basic Hello World script, and anytime I try to compile it from the command line (example gcc -o hello.o hello.cpp
) I get a massive cascade of errors before being informed that the linker exited with an error. However, when I build the file via the Eclipse C++ IDE, it works fine. I'm on MacOS 11.3.1. Checking the version of the compiler with gcc -v
gives me
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I've verified that if I simply put a main function that returns a value it will compile, so the issue is somewhere with the std::cout << "Hello world";
line. I have some experience with other languages, but this is my first attempt at anything with C++.