I wrote a simple code as follows and saved it as 1.cpp
using namespace std;
Then I input
in my mac terminal, then nothing happens. However if I changed the code above a little (for example, get rid of a ;), then it complains.
Does anyone know how to let it show "Hello, world!"?
Many thanks ahead!
Last edited on
Odds are, if nothing was displayed after running the command, it just worked. Look for a file in that directory called 'a.out,' this is your compiled output file; run it by typing './a.out'
To name the output file, you would type
g++ sourcefile.cpp -o outputfile