SublimeClang编译为C,即使在.cpp文件中也是如此

时间:2014-12-21 08:26:38

标签: c++ sublimetext2 clang++

我正在尝试使SublimeCLang插件在SublimeText 2上运行。我已按照安装说明进行操作,包括ctypes解决方法和编译libcache。

该插件有效,但我注意到它的编译为C,即使我正在使用C ++文件。例如,给定此代码:

#include <iostream>

struct vector2
{
    float x , y; 
};

int main()
{
    vector2 v;

    for(int i = 0 ; i < 100 ; ++i)
        std::cout << i; 
}

报告了以下错误:

  

/ usr / include / c ++ / 4.9.2 / iostream:38,10 - 致命 - 找不到'bits / c ++ config.h'文件
  您是否正确配置了clang使用的包含路径?   有关如何配置SublimeClang的更多详细信息,请参阅http://github.com/quarnster/SublimeClang   /.../main.cpp:12,2 - 错误 - 必须使用'struct'标签来引用'vector2'类型   /.../main.cpp:17,7 - 错误 - 预期表达式

我尝试在SublimeClang.sublime-settings add_language_option - x c ++ , then passing settings`数组中启用on the,但没有任何更改。
这是我的完整设置文件:

// Whether or not the plugin is enabled. Useful if you want to disable
// the plugin completely for a specific project.
"enabled": true,
// Whether or not to hide the clang output panel when it's empty
"hide_output_when_empty": true,

// Delay in ms until recompiling the file after the buffer is modified
// Set to 0 to disable.
// You probably also want to change the reparse_use_dirty_buffer
"recompile_delay": 0,

// Whether or not to inhibit the Sublime Text 2 built in word completions
"inhibit_sublime_completions": false,

// Whether to use the saved file or the (possibly) dirty buffer contents when reparsing
"reparse_use_dirty_buffer": false,

// Whether or not fast completions are enabled. Usually you'd put
// "sublimeclang_enable_fast_completions": false, in the project
// settings if it's problematic in that project. You can also
// runtime toggle fast completions alt+d,alt+f, however if it
// is disabled for the current project (or globally in your
// user settings) it will not be enabled. In other words
// this setting, when set to false, overrides whatever the
// keyboard toggle is set to.
"enable_fast_completions": false,

// When set to true will output the final options used to the python console
"debug_options": false,

// Number of worker threads to create. If set to -1 it'll create
// one thread per cpu
"worker_threadcount": 8,

"add_language_option":true,

"additional_language_options":
{
    // For example, you can use "c++": ["-std=c++11"] to enable C++11 features.
    "c++" : ["-std=c++11"]
},

"options":
[
    "-isystem", "/usr/include/c++/4.9.2",
    "-Wall",
    "-x c++"
]

有没有办法告诉sublimeClang编译为C ++而不是C?

0 个答案:

没有答案