Reputation: 455
I need some help configuring Sublime Text 2 with MinGW. All I did was add MinGW to my path variable. I've been having some issues however. for example, this code won't even pause to ask the user for input and immediately puts cin
into a failed state.
int input = 0;
cin >> input;
It is not a problem with my code either, because I tested it with eclipse and it works fine. What else do I need to get Sublime Text 2 to work with MinGW?
Also, if it would be easier, I'm open to a new compiler.
Upvotes: 1
Views: 1884
Reputation: 2749
Sublime Text is an advanced text editor, not an IDE. As requested, here are some instructions for compiling and running a program written with Sublime Text.
Launch a command prompt (press windows-key+R, type cmd
, and press enter) and verify that the MinGW bin folder is in your path with g++ --version
. If a version is returned, navigate to the location of your C++ source files with the cd
command. For example, cd "C:\Users\abaratham\Dev\test"
. Then compile the source files with g++ -o myprogram.exe main.cpp othersource.cpp ...
.
If the build is successful, you should see a new myprogram.exe file in the project folder. If it's a command line program, you can run it in the same console with myprogram
.
As you begin to develop software with many C++ source files, you might find it useful to use a high level build system such as CMake or SCons. Whichever you chose, you'll be able to generate makefiles and compile your project with mingw32-make
.
Upvotes: 1