简体   繁体   中英

Why doesn't Vsc show errors?

I am using Vsc to write my program in C, the program should return an error but nothing is shown, only the final code is provided (code = 3221225477), how can I get the error displayed?

The final output is: [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 I have already installed.Run and the C / C ++ extension

The Microsoft C/C++ extension if configured properly ( problemMatcher in tasks.json ) should also trigger similar errors based on the compiler you select.

After investigation, you might get some help from the clangd extension.

  1. Install the extension in VS Code from https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
  2. Open your project folder in VS Code and open the source file (like main.c ).

Then this extension should run clangd in the background and show a warning "Format specifies type 'char *' but the argument has type 'char' (fix available)".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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