Sublime Forum

Building and Running C++ Files

#1

So I’m somewhat new to this, and I can’t work out how to build and run my code once I’ve written it. Every time I go to select ‘Run’, this appears in the built-in console:

[Finished in 0.0s with exit code 127]bash: g++: command not found

I’ve selected ‘C++’ under ‘Build System’, but this doesn’t seem to have any significant effect.

I’m really not too sure how to solve this.

Any help would be greatly appreciated.

0 Likes

#2

Sounds like you don’t have the compiler installed. What system are you working on (you could always search for somehthing like "installing g++ on ") if you don’t want to wait for a forum response.

0 Likes

#3

I’m using Mac OSX Snow Leopard (10.6.8). Does the compiler not come with the Sublime Text app then?

0 Likes

#4

No, it doesn’t—I’d recommend installing homebrew (mxcl.github.com/homebrew/) to get things like g++. Or you can install Xcode and then install its command-line tools, which homebrew itself will most likely recommend.

0 Likes

#5

It seems I can’t download the latest version of XCode because my OS doesn’t support it. So once I’ve downloaded Homebrew, what do I have to do to get my code to run from the Sublime Text app?

0 Likes

#6

Unfortunately, I am not an OS X user so I can’t be 100% sure about this. You may be able to do something like

brew install gcc

Again, I’m not 100% sure. You may try to search for the answer on the web, or wait for anther. I was a little slow to reply so you may have fixed this already.

0 Likes