Executing C++ in VS code is not Clean - c++

VS code screenshot
Hii, Im trying to execute C++ program in VS code in ubuntu 16.04 but the output i get is mixed with other things like I've shown in screenshot the same if i execute in terminal I get the clean output of my program without getting mixed with other things like these :-
[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-qdt8mbun.gul" 1>"/tmp/Microsoft-MIEngine-Out-z70qnvlb.zrn
how shall I get rid of it in VS code.

In vscode, using ctrl+f5 will generally cann't take input in the programme. For this you have to manually set task.json file.
Here i have configured my vs code for that.By pressing ctrl+shtf+b it will take input and show output.You can check it out.
VS Code Setting (Live input output) to make competitive programming easy and program analysis.
Youtube Video

Related

How do I take inputs in from terminal directly on VSCode using Clang C++ Debugger?

I'm currently trying to debug a C++ code using VSCode. I have been able to successfully debug Python code many times by putting in my inputs and then debugging the code, but for some reason C++ does not let me debug my code in the built in terminal. The error message looks like this:
The Message I'm getting in Terminal - Image
I've looked at a lot of different Stack overflow posts, but none of them seem to work. Here are some things I've tried:
In my launch.json, I tried making "externalConsole": true, but this doesn't seem to fix anything. I have included a picture of my launch.json as well.
Picture of my Launch.json
In my tasks.json, I tried adding an "Open Terminal" line which I got online, but this doesn't seem to work.
Picture of my Tasks.json
I added "code-runner.runInTerminal": true, to my settings.json, but this doesn't seem to work.
Picture of my Settings.json
I've also included my configurations
Picture of Cpp_properties.json
Right now, I'm just clicking on the little "debug" button at the top and then clicking on "Debug C/C++ Code", but this doesn't seem to work. I've tried downloading other extensions to run my code that way but that also doesn't work.
I'm using MacOS, and I think I'm using Clang as my C++ compiler, though I'm not too sure about this.
Whenever I try doing something basic as like running the code (e.g. cout << "Hello World"), this works, but for some reason the cin code doesn't work? Like I'm not able to give my code ANY input. I need to be able to give my code input for USACO...

Code not running from terminal in vs code

Image is showing that when i used terminal to run the code, it wont run. code is running perfectly in output section, opened vs code after a month and shows this type of output in terminal
You're just compiling the code, not running it. To run the code, type the following:
./exe_name.exe
..or in your case:
./tut4.exe
./tut5.exe
If you're using a mac machine, just replace .exe with .out

i don't know what is wrong with vs code in running cpp

i just started to code in cpp and nothing is working idk if i didn't install the gcc properly or what but i already set the path of the bin file idk why it refuses to run
the code:
#include<iostream>
int main()
{
std::cout<<"hello";
}
and the problem is that when I try to use the "code runner extension" it is not working so I just press f5 and then when I get the error messages which says at first "could not find the task file'c/c++:g++.exe build active file' " and I get three options 1:debug anyway
2:configure task
3:cancel
when I choose debug anyway I get this error here
Since you're on windows consider installing Visual Studio or CLion. They're more beginner friendly - VSCode can get tricky to run c++ on windows. Either way, looks like you're trying to run your project without building it first. There should be a build option right next to the run option. Try building it, then running. The build is what compiles and creates the project.exe file, which is what the compiler is saying isn't there.
The referenced IDE's always auto-build on run, so there's that
If you're familiar with using the command line, these commands will do what you want, assuming the .cpp file is in your current directory.
g++ <FILENAME>
./a.out
There are wonderful flags you can add to the first command (the compiling command) like -Wall, -Wextra, -o, and many more. But, since it seems like you're just starting out, there's no need to worry about those!
If you're not familiar with the command line, I would encourage you to become familiar! It is an extremely powerful tool for a programmer. Here is a YouTube video that talks about it.

Netbeans IDE 8.0.2 C++ Input/Output Error

I installed netbeans C++ on windows 7 and used Cywgin4 as the compiler. When I run any program even a simple Hello world it does compile and run however I also get the error below. I can't seem to find any reference to it online. Can anyone point me in the right direction for a solution? Thanks!
read from master failed
: Input/output error
RUN FAILED (exit value 1, total time: 47ms)
I do not understand all the surrounding details of this problem as I am new to C/C++. However, if you:
Open up NetBeans
Right click on your C++ project file
Select "Properties"
There should be a category called "Run".
Under this category, find the option called Console Type and make sure that Standard Output is selected as shown in the screenshot below:
I was having the same problems when the console type was selected as Internal Terminal.
For my setup, changing this option to Standard Output got rid of this error. However, I do not fully understand how this change affects the overall properties of my project. Wish you good luck.

Debugging C++ in Netbeans

I am very new to work c++ Programs with Netbeans IDE in Ubuntu. I wrote a simple Hello World Program and tried to debug it using step Into. When I Click Step Into Option From Debug Menu I got new window opened in the name of " Diassembly(main) " . The Debug process didn't reach my source code line at any way. I repeatedly click Step Into Function At last the process got end Without Tracing my source code line. But In the Debug output window I got the Correct Result.
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello";
cout<<"World";
}
Why This process Control goes to the Diassembly (main) window ? How to rectify this problem ?
You must compile with -g option, otherwise the debugger won't be able to stop on a breakpoint. As for disassembling window - I can't reproduce that (I'm on Netbeans 7.4 in Ubuntu 13). You should just close the window if you don't need it.
First, you have to toggle a break point in your code by clicking on the line number of the line you want to stop in source window, if you did not. Then hit Debug.
Don't step into function that you not build from source, just step over it.
Pehaps that there is an answer here (i can't comment sorry)
"No source available for main()" error when debugging simple C++ in Eclipse with gdb