Gcc

Joined
Jul 7, 2007
Messages
137
Reaction score
4
Points
18
Location
Baltimore
Your Mac's Specs
iPod Video| 15" MacBook Pro | iPod Shuffle
I have a C++ file.
Code:
#include <iostream>
using namespace std;

int main()
{
	cout << "Hello World!" << endl;
	return 0;
}

saved as main.cpp

I got to that directory in terminal and typed ' c++ main.cpp ', but I dont know if nothing happend or if it compiled. How can i tell? And how do I actually execute it?
 
Joined
Mar 14, 2005
Messages
443
Reaction score
3
Points
18
Location
Atlanta, GA
Your Mac's Specs
17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
type " ls " right after you type that. The " ls " command is short for list, which means it will list any files within the current directory. So when you " ls " do any other files show in besides the main.cpp ?
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
I believe you should find a file call a.out. If you did not name the excutable file. That is what you get normally with C and other compilers.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top