Sublime Text 2 and MinGW

Good afternoon!

Can anyone share their experience on how to connect a MinGW compiler to Sublime?

I found the configuration on the Internet, but when I run compiled programs that drop errors with missing files from "../MinGW/bin/".

Config:

{ "cmd": ["mingw32-g++.exe", "-o", "$file_base_name", "$file_name"], "path": "c:\\Program Files\\MinGW\\bin\\" } 

Thanks!

UPD

I found the answer to my question! I had to add one parameter to cmd . This is the "-static" .

So this is my MinGW.sublime-build , which works fine:

 { "path": "c:\\Program Files\\MinGW\\bin\\", "cmd": ["mingw32-g++.exe", "-static", "-o", "$file_base_name", "$file"] } 
+6
source share
2 answers

Be sure to specify the bin file in the "Path" variable on your system.

Open the Start menu and enter “variable” or “environment variable” (or google it) to find how to do this. You will be taken to a window with a large number of variables, find the Path variable (not PATH) and add the path to the bin MinGW folder.

And btw, as suggested, you should change file_base_name by file and put the file_name of the file in which you put file_base.

Here is the command that I personally use:

"cmd": ["C:\\MinGW\\bin\\mingw32-g++.exe", "-Wall", "-time", "$file", "-o", "$file_base_name"]

+7
source

You should use $ file instead of $ file_name. $ file_name extends only the name, while $ file expands to the full path.

The changed configuration will be

 { "cmd": ["mingw32-g++.exe", "-o", "$file_base_name", "$file"], "path": "c:\\Program Files\\MinGW\\bin\\" } 
0
source

Source: https://habr.com/ru/post/921186/


All Articles