Hi, I switched from ubuntu to Windows recently and found it really tough to get some simple document stating "How to setup sublime for C++ in Windows 10". Somehow I successfully did it after so many trials and thus I have decided to document it myself.
- First of all you need to download MinGW compiler for windows as it doesn't come with C++ compiler like ubuntu. You can go to MinGW website and download it. I have also shared it on my google drive and you can go and download it from there. All following steps will be as per version I have shared in my drive. There may be little changes in latest versions so you can explore and figure them out. Google Drive Link for MinGW
- After download is successful, extract this file in one of folder e.g. I have done that in C:\ drive. Also I have named this as MinGW. So path in case of my computer is C:\MinGW
- Now you need to add environment variable for this. Click on start and type Environment Variable, you will get "Edit the system environments variables", click on that.
- Go to Advanced>Environment Variable, and click on it. You will see all environment variables present in your system. Click on New
- Now you need to add g++.exe path from MinGW folder. Usually that is present in bin folder under MinGW i.e. for me it is C:\MinGW\bin\g++.exe . Put this in variable value and save it.
- Now your windows is set up with C++ compiler. Now go to Sublime Text for further settings.
- Open "Tools>Build System>New Build System".
- Copy and paste below content in build and save it with some name such as "my_cpp_build". Just make sure to change 'path' to your system's path. I have set it as mine PC's path.
- As you can see in above file. I have set input file name as 'inputf.in' and output file as 'outputf.in'. Please make sure that you have these files in folder where your cpp file is present for which you want to compile and see output giving some input. Use 'Ctrl + B' for build and run.
No comments:
Post a Comment