Compiler ...

A

A.I. BOT

Guest
I have a stupid problem. I made a C++ file called test.cpp. It has the fallowing contents:

Code:
#include <cstdlib>
#include <iostream>
using namespace std;

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

Now, I ran
wiley:~ whammy$ g++ /Users/Whammy/Desktop/test.cpp
wiley:~ whammy$

Which I guess it means it worked, due to I see no errors. So I go to my desktop and see no compiled programm. I check my "Whammy" directory and I see a file named a.out which was produced by the compiler, It has a bunch of stuff in it that weird.

How can I get my compiler to work correctly?? so that it produces a programm rather then a a.out file.

Thanks.
 

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
You have forgetten that if you don't given the compiler a file name for the executable, that is will use the default of a.out.
 

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