can not run "Hello World"

Downloaded the free C++ for mac from CPP Edit v 1.285 (macupdate).
Keyboarded in "Hello World" program (I have never programmed before.)
Saved as C++ format.
Got error message; sh: C++: command not found (127)
Then saved as just plain C got: sh: gcc: command not found (127)
Then cut and pasted same code from their site (macupdate) and this site's tutorial. Same message.
Anybody to lend any advise it would be much appreciated.
MB
Hey, I use Dev- C++ (http://www.bloodshed.net/dev/devcpp.html)
Here's the one I learned:

#include <iostream>
using namespace std;

int main()
{
cout << "hello world" << endl;

system("pause");

return 0;
}

Hello,

you need to download the command lines for xcodes to work ..

i had the same issue

xcode command line tools


https://developer.apple.com/xcode/ too download it..

another option would be using eclipse for c++ which works without the command lines for xcodes
to MP3NUT
You suggest Dev-C++ as opposed to C++ Edit. Is the former known to work and the latter known not to? Is this just random action?
You suggest some code. I tried it in the C++Edit program and it produced the same error messages.

to Brooklyn
You suggest xcode command line tools. Are the command line tools a seperate file that I only need it? Or do I need the whole xcode program to run C++ Edit? And will it sort itself out and install itself wherever it needs to go to be accessed by C++ Edit. And from what I can tell Xcode is a programing language in itself that has some relationship to C++.

Is there a simple turnkey way of running C++ to do simple tutorial level of codeing?

Thank you to both of for your help.
Can I see the code you programmed? Also, Visual C++ is a better compiler than DEV-CPP- IMO.
Last edited on
hold on... eclipse is cross platform? i didn't know that. where is it located at?
closed account (zb0S216C)
Don't use Dev-C++; it's as old as Jesus' sandals. Use either WxDev-C++, Code::Blocks, or Visual C++. By the way, without the code, it's hard for us to know what you could be doing wrong.

Wazzal
Last edited on
in this case i don't think thrice written hello world code is the problem here

edit: its probably the compiler is downloaded wrong or something
Last edited on
I believe the OP is running a Mac...why is everyone suggesting Windows/Linux IDEs?

Here is an entire post regarding compiling on Mac machines:
http://www.physicsforums.com/showthread.php?t=170304

Reading over the bits and pieces of it, it looks like Xcode is pretty advanced (I don't have a mac so I don't know). They suggested using a Mac based text editor to write the code and using gcc to compile it. They also mentioned installing the Apple Dev kit to get access to a lot of things (which I believe comes with Xcode, gcc, and command line features). Maybe doing some research through google will help you find more since I don't know of anyone on the forum who uses a Mac, but once set up, you're good to program like everyone else.
Last edited on
@Volatile Pulse Code::Blocks and Eclipse are available for Mac.
I know Code::Blocks and Eclipse do now that you mention it, but completely forgot. But with the other's suggesting Visual C++ and Dev-C++, I wanted to make sure the OP understood that some things aren't available. Also, I believe it's more of finding a compiler that works on Mac. I didn't know this either, but Mac use gcc for Xcode and is the primary compiler for Mac C++ coding.

I have no idea how to install gcc on Mac, but like my last post said, I believe they cover ways of getting it.
Don't forget Orwell's Dev-C++ as well.
so wait.. eclipse still isn't made for mac yet?
Topic archived. No new replies allowed.