繁体   English   中英

为什么 Vsc 不显示错误?

[英]Why doesn't Vsc show errors?

我在C用Vsc写我的程序,程序应该返回错误但什么也没有显示,只提供了最终代码(代码= 3221225477),我如何才能显示错误?

最后的 output 是: [Done] exited with code=3221225477 in 0.569 seconds

#include <stdio.h>
#include <stdlib.h>

int main(){

    char x = 'a';
    printf("%s", x);   //Error cause i'm using %s for a char
}

Ps 我已经安装了。运行和 C / C ++ 扩展

如果配置正确,Microsoft C/C++ 扩展( problemMatcher中的tasks.json )也应该根据您的编译器触发类似的错误 select。

经过调查,您可能会从 clangd 扩展中获得一些帮助。

  1. https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd在 VS Code 中安装扩展
  2. 在 VS Code 中打开项目文件夹并打开源文件(如main.c )。

然后这个扩展应该在后台运行 clangd 并显示警告“格式指定类型‘char *’但参数的类型为‘char’(修复可用)”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM