zoukankan      html  css  js  c++  java
  • sublime配置c++环境

    1,安装编译器g++

     下载地址:https://sourceforge.net/projects/mingw-w64/

     装好mingw之后将bin/目录添加到path环境变量中去,然后再cmd中输入以下代码,测试是否装好

    g++

    如果出现下图所示情况,表明安装成功

    2,在sublime中配置环境

    tools  > Build System > New Builed System 

    将其中的内容改成如下,并保存为CPP.sublime-build文件

    {
        //"shell_cmd": "make",
        "cmd": ["g++","-Wall", "${file}", "-o", "${file_path}/${file_base_name}"],
        "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
        "working_dir": "${file_path}",
        "selector": "source.c, source.c++,source.cpp",
        "encoding": "cp936",
        "variants":
            [
                {"name": "Run",
                "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", 
                "${file_path}/${file_base_name}"]
                },
                {"name": "RunInCommand",
                "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"]
                },
                {"name": "RunInShell",
                "shell_cmd": " start cmd /c ""${file_path}/${file_base_name}"&pause" "
                }
            ]
    }

    然后Preferences > Key Bindings中输入以下内容

    {"keys": ["f5"], "command": "build", "args": {"variant": "Run"}},
    { "keys": ["f6"], "command": "build", "args": {"variant": "RunInCommand"} },

    ctrl+n建立新文件,ctrl+s保存为.cpp文件,tools > Build System > CPP

    写好之后f5或者f6编译运行程序

    3,有用的插件

    clang, EasyClangComplete、SublimeCodeIntel

  • 相关阅读:
    讲一下创业公司的技术架构演进
    Nginx二级域名配置
    Java分页下载
    Solr6+IKAnalyzer分词环境搭建
    消息发送平台简单架构设计
    优先级线程池实现
    Spring缓存框架原理浅谈
    Archaius 原理
    SpringCloud+Consul 服务注册与服务发现
    EndPoint详解
  • 原文地址:https://www.cnblogs.com/54hys/p/10513666.html
Copyright © 2011-2022 走看看