V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
StackGao
V2EX  ›  Visual Studio Code

VS Code 编写 C++有没有办法开启语法检查?

  •  
  •   StackGao · 2017-03-17 12:13:04 +08:00 · 5982 次点击
    这是一个创建于 2595 天前的主题,其中的信息可能已经有所发展或是发生改变。



    明显多了括号都不提醒? 搜了半天了 难道我用的是假 mac...

    同目录下的 java 文件就会提示.

    (cpptools 插件已安装)
    14 条回复    2017-04-16 04:03:03 +08:00
    herozhang
        1
    herozhang  
       2017-03-17 12:35:58 +08:00 via iPhone
    貌似还要添加一个配置文件
    h4x3rotab
        2
    h4x3rotab  
       2017-03-17 13:12:22 +08:00 via iPhone
    xcode 是世界上最好的 c++ ide
    StackGao
        3
    StackGao  
    OP
       2017-03-17 15:21:21 +08:00
    @herozhang #1

    c_cpp_properties.json 和 launch.json 和 settings.json 和 tasks.json 都弄完了, 不好使- -}}}
    Lonely
        4
    Lonely  
       2017-03-17 15:25:24 +08:00
    换 clion
    StackGao
        5
    StackGao  
    OP
       2017-03-17 15:26:42 +08:00
    @h4x3rotab #2 超大型的项目 xcode 卡成狗了... vscode 简直光速.
    jmc891205
        6
    jmc891205  
       2017-03-17 16:00:12 +08:00
    @h4x3rotab Visual Studio 表示不服
    h4x3rotab
        7
    h4x3rotab  
       2017-03-18 09:40:29 +08:00 via iPhone
    @StackGao 你那是超大型的 swift 吧
    StackGao
        8
    StackGao  
    OP
       2017-03-18 17:18:48 +08:00
    @h4x3rotab #7 就是 C++的. 文件比较多. 一直 index
    icylogic
        9
    icylogic  
       2017-04-14 13:51:45 +08:00
    https://ooo.0o0.ooo/2017/04/14/58f062e4de57c.png

    ?
    新开的 Window ,新建的文件,并没有写什么 .json
    icylogic
        10
    icylogic  
       2017-04-14 13:55:35 +08:00
    StackGao
        11
    StackGao  
    OP
       2017-04-14 14:24:06 +08:00
    @icylogic #10 什么插件....
    icylogic
        12
    icylogic  
       2017-04-15 06:38:22 +08:00


    应该是 C/C++ Clang Command Adapter 这个插件吧
    StackGao
        13
    StackGao  
    OP
       2017-04-15 17:12:33 +08:00 via iPhone
    @icylogic

    这个插件可以! 但大项目里有一个比较严重的问题, 项目中所有的 include 的路径都是针对根目录的相对路径. 此时 "C/C++ Clang Command Adapter" 就找不到这些路径了了, 都提示 include 文件未找到, 貌似它只能找到相对当前文件的 include 路径.![图片]( http://)
    icylogic
        14
    icylogic  
       2017-04-16 04:03:03 +08:00
    @StackGao
    我用它看几百 M 的源码都没啥问题 …… 打开几秒就可以一路 Ctrl + Click trace 源码了

    这问题应该很简单, clang.cxxflags 加一个
    -I./
    或者
    -I${WorkspaceRoot}
    可以用 Show Executable and Compile Options 看一下当前 clang 的具体选项

    先把人家文档看一下吧 ……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3297 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:38 · PVG 08:38 · LAX 17:38 · JFK 20:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.