Home > database >  C and VScode integration
C and VScode integration

Time:08-24

Tried my whole day to integrate between vscode and c with no success i get output

[Done] exited with code=1 in 0.124 seconds 

in VScode when i try to write c code,

My input:

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
{

I have downloaded VScode and worked through this guide https://code.visualstudio.com/docs/cpp/config-mingw

I have created a path as explained in the guide Where i added the path Inside this i added a new Path

In the command prompt i typed

  1. First : pacman -S --needed base-devel mingw-w64-x86_64-toolchain

in the command prompt when i type g --version gdb --version

i get this

""g (Rev1, Built by MSYS2 project) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."" In additional i have download the extension in VScode (runner and c /c

Would like to get help here so i can start using c in VScode I am using windows 10

CodePudding user response:

I solved the problem, I had to delete runner, restart vscode, reinstall runner and restart vscode again, Hope it will help others.

CodePudding user response:

Your code gets executed and program shuts itself. If you add getch() that means "Get Character", the program will wait to get a character before exiting Note: Include conio.h when you use getch()

Hope this will solve your problem

#include <iostream>
#include <conio.h>
int main() {
    std::cout << "Hello World!";
    _getch();
    return 0;
}
  • Related