用崇高的文本2不能建立C ++程序 [英] Can't build C++ program using Sublime Text 2

查看:182
本文介绍了用崇高的文本2不能建立C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想你们很多人正在使用或曾经使用文本崇高2编辑器。我有奇怪的错误:C ++程序不能建

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.

C ++崇高的构建

{
    "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
    "working_dir": "${file_path}",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c, source.c++",

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
        }
    ]
}

我发现,当 CMD 数组包含任何取代前pression像 $ {文件} $文件,构建不启动。否则,它开始。

I found that when the cmd array contains ANY substituted expression like ${file} or $file, build doesn't start. Otherwise it starts.

它不从编译无所谓。当我试着CMD:通知-OSD,$文件] ,它没有工作;但CMD:[通知-OSD,sometexthere] 它的工作

It doesn't matter from compiler. When I've tried "cmd": ["notify-osd", "$file"], it didn't work; but with "cmd": ["notify-osd", "sometexthere"] it worked.

由手编译作品的权利。

我的程序:

#include <iostream>

int main() {
    std::cout << "Hello World";
}

我使用Ubuntu 12.04,32位。崇高编辑器版本:2.0.1

I use Ubuntu 12.04, 32bit. Version of Sublime Editor: 2.0.1.

如果它不是,我会问这个问题的地方,请告诉我什么是正确的。

If it isn't the place where I could ask this question, please tell me what's the right one.

推荐答案

编辑你的C ++,崇高的构建文件....就像一个魅力。

Edit your C++.sublime-build file....works like a charm.

{
    "cmd": ["g++", "-Wall", "-Wextra", "-pedantic", "-std=c++11",   "${file}", "-o", "${file_path}/${file_base_name}"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "g++ -Wall -Wextra -pedantic -std=c++11 '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
        }
    ]
}

这篇关于用崇高的文本2不能建立C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆