Can't build C++ program using Sublime Text 2

后端 未结 3 1790
迷失自我
迷失自我 2020-12-18 05:03

I think many of you are using or used to use Sublime Text 2 editor. I have strange error: C++ programs can\'t be built.

My C++.sublime-build

3条回答
  •  爱一瞬间的悲伤
    2020-12-18 05:26

    It took me several hours to get C++ compiling working on Sublime Text, and I still have some slight problems (like the fact that Sublime Text can't apparently execute the program in an externe window/console).

    Here's my config file:

    {
    "cmd": ["C:\\MinGW\\bin\\mingw32-g++.exe", "-Wall", "-time", "$file", "-o", "$file_base_name"],
    
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    
    "working_dir": "${project_path:${folder}}",
    
    "selector": "source.c",
    
    "shell": true,
    
    "encoding": "latin1"
    
    }
    

    (make sure to change the encoding to utf8 if the compiler doesn't work)

    Also, add the MinGW's bin folder to your OS's Path variable (look up 'environment variable' in the start menu, and then look for the Path variable).

提交回复
热议问题