Luca Orlandi
Luca Orlandi

Reputation: 65

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
}

P.s. I have already installed .Run and the C / C ++ extension

Upvotes: 0

Views: 155

Answers (1)

Lex Li
Lex Li

Reputation: 63264

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)".

Upvotes: 1

Related Questions