Code not running from terminal in vs code - c++

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

Related

VSCode Extension Run Code can't run C++ in terminal

I am new in C++. I like VSCode very much. I want to run my C++ code in VSCode and so I am using MinGW and Run Code Extension of VSCode.
MinGW setup worked and I could also run my C++ code in the output terminal in VSCode, but when I enabled Code Runner in the settings to run my code in the terminal (so that I can take inputs), I am getting this error:
bash: cd: d:\CodeForces" && g++ inSearchOfAnEasyProblem.cpp -o inSearchOfAnEasyProblem && d:CodeForces"inSearchOfAnEasyProblem: No such file or directory
My Folder structure is: d://CodeForces//inSearchOfAnEasyProblem.cpp
I am trying to run this file: inSearchOfAnEasyProblem.cpp
I am using the Bash terminal. I tried to change the terminal to cmd, but when I click the run button of code runner, it always runs in a bash terminal.
enter image description here
Can anyone please help me? I would have been grateful.

Executing C++ in VS code is not Clean

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

Xcode 8.3: Run target with input from file

I wrote a simple C++ program that requires some input to run. In the terminal I simply run in ./myProgram < fileWithData.txt. However I could not figure out how to specify and input file for the target executed in Xcode. I used the command line project. Of course I could use a different target, for example run Terminal.app and then pass it the executable with the input file but then I can no longer debug it.
This question: Cannot get lldb to read file input explains how to set the input path in lldb, but I could not find a way to specify lldb commands that are executed before the process is started.
I don't think there's a way to do this entirely from within Xcode. However if you set the Run Scheme in Xcode to the launch mode "Wait for executable to be launched," hit run, and then run your program from Terminal.app with the appropriate piping, the Xcode-embedded lldb will connect to it.

Run a C++ executable in Matlab from SSH server

I'm trying to run an executable, generated from C++ code, in Matlab.
To do this I use the command
system('unset LD_LIBRARY_PATH; /home/Documents/ServerFolder/ExecutableFiles/program_23 argument');
where program_23 is the executable generated by the C++ code.
When I do that in Ubuntu, it works perfectly fine.
The problem arise when I do that from a SSH server (i.d. calling Matlab from a server, but running the exact same script that works in Ubuntu).
In particular, if I add
[status,cmdout] = system('unset LD_LIBRARY_PATH; /home/Documents/ServerFolder/ExecutableFiles/program_23 argument');
I can see that status is different from 0, meaning a failure of the system command.
Does anyone have any idea on how to make this work?
Thank you

What needs to be done to get a distributable program from Eclipse?

I’ve produced a C++ program in Eclipse running on Redhat, which compiles and runs fine through Eclipse.
I thought that to run it separately to Eclipse you use the build artifact which is in the directory set via the project’s properties.
However this executable doesn’t run (I know it’s an executable as I’ve set it to be an executable via the project’s properties and it shows up as such via the ls command and the file explorer).
When attempting to run it using the executable’s name, I get the error:
bash: <filename>: command not found
When attempting to run it as a bash file:
<filename>: <filename>: cannot execute binary file
And when running it with "./" before the file name, nothing happens. Nothing new appears in the running processes and the terminal just goes to the next line as though I’d just pressed enter with no command.
Any help?
You've more or less figure out the first error yourself. when you just run <filename> , it is not in your PATH environment variable, so you get "command not found". You have to give a full or relative path when to the program in order to run it, even if you're in the same directory as the program - you run it with ./<filename>
When you do run your program, it appears to just exit as soon as you start it - we can't help much with that without knowing what the program does or see some code.
You can do some debugging, e.g. after the program just exits run echo $? to see if it exited with a particular exit value, or run your program using the strace tool to see what it does (or do it the usual way, insert printf debugging, or debug it with gdb)