How to build and run c++ programs in Sublime Text 2, Windows 8?

前端 未结 6 775
心在旅途
心在旅途 2020-12-29 10:50

I installed Codeblocks with mingw, chose default compiler, and could build and run a simple hello program without errors.

I installed Sublime Text 2, copy pasted the

6条回答
  •  生来不讨喜
    2020-12-29 11:36

    (I assume you already have installed MingW in your computer.)

    You need to go to Preferences->Browse Packages->C++ folder->C++.sublime-build; bring this C++.sublime build file into the sublime text editor and now paste this code :

    { "cmd": ["g++", "$file", "-o", "$file_base_name"], "selector": "source.c++", "working_dir": "$file_path", "variants": [ { "name": "Run", "cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"], "shell": true } ]
    }
    

    Hope this helps you.

提交回复
热议问题