Kentaro Tanaka February 2016

How could I run C++ on Sublime Text 2 for mac?

#include <iostream>

using namespace std;
int main ()
   cout << "Hello World";
   return 0;

When I code simple C++ like that on Sublime Text 2 for Mac, I anytime get this kind of error.

File "/Users/Library/Application Support/Sublime Text 2/Packages/C++/untitled.cpp", line 3
using namespace std;
SyntaxError: invalid syntax
[Finished in 0.2s with exit code 1]

Do you guys have any suggestions to fix it?


user3639963 February 2016

You will probably need to install the Xcode Command Line tools before you can compile from Sublime Text 2.

Post Status

Asked in February 2016
Viewed 2,187 times
Voted 7
Answered 1 times


Leave an answer