VS Code C++ issue - c++

I tried to compile a cpp file using VScode, but I have got an issue. The tdm-gcc have already added to environment variable. I tried to reboot my computer but it didn't work. Here is the error.
error:
/usr/bin/bash: D:TDM-GCC-64bing++.exe: command not found
The terminal process terminated with exit code: 127

Related

VS Code Error when compiling C++ Program: 'cmd' is not recognized as an internal or external command

I attempted to follow through on VS Code's method on making C++ code work on their editor. I did this successfully on my laptop but when I tried compiling it, I was met with the error:
* Executing task: C/C++: g++.exe build active file
Starting build...
C:\msys64\mingw64\bin\g++.exe -fdiagnostics-color=always -g "C:\Users\salty\Documents\Programming\C++ Scripts\myProgram\main.cpp" -o "C:\Users\salty\Documents\Programming\C++ Scripts\myProgram\main.exe"
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Build finished with error(s).
* The terminal process failed to launch (exit code: -1).
* Terminal will be reused by tasks, press any key to close it.
This is the entire error message plus extra things in my editor.
If I try and copy and paste the command in the message into Windows Power Shell, it actually works (New .exe file appeared in the correct directory and runs without fault).
These are my environment variables for User, and these are my System variables.
I've tried uninstalling and re-installing and changing the paths around. I'm new to C++ programming and how compilers work in general, but I'm not sure why VS Studio says it doesn't recognize cmd among others it could've not recognized.
Why is it giving me this error?
Edit: I believe I didn't include a return 0; line in the program. Correcting this did not fix the issue.
I am not sure what I poked into place or if I just was too incompetent to realize something, however adding %SystemRoot%\system32 to my PSModulePath environment variables somehow fixed the issue, and since that action I have yet to replicate the compile error.
I don't know if adding that variable to my environments permanently fixed it or VS Studio needed a moment to process some things. Thanks anyways!

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.

C++ build failing on MacOS

I'm trying to run my C++ program on my Macbook and I'm trying to run my program in VSCode by running the build task C/C++:clang++ build active file. However, every time I do this I get this error ld: can't open output file for writing: /Users/admin/first/first, errno=21 for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The terminal process terminated with exit code: 1
This appears to be a simple permission problem here:
ld: can't open output file for writing
The linker cannot write to the file specified.
Edit: As correctly pointed to by molbdnilo, the error 21 is EISDIR, which means the file you are trying to write to already exists as a directory. So ... just this folder? :)
Did you brew install any c++ tools? Sometimes that is the source of these issues. The program is trying to use native OS versions of things when it should use Homebrew's or vice versa.

Unable to build and run c++ code in visual studio code

I have setup the correct path for mingw and am successfully able to compile my code using terminal in vscode. But when I press ctrl+shift+b to build i get the following error in my terminal
Executing task: C:\MinGW\bin\g++.exe -g 'c:\Users\Ansh Kapoor\Desktop\cpp\main.cpp' -o 'c:\Users\Ansh
Kapoor\Desktop\cpp\main.exe'<
/usr/bin/bash: C:MinGWbing++.exe: command not found
The terminal process terminated with exit code: 127
whereas the same code is successfully executed when I write
g++ main.cpp -o 'main.exe'
Now I have checked the path and environment variables and all those things are correct.
The error in finding the proper path was because of using git bash as the terminal rather than windows powershell or cmd.

XCode shell script error

I just moved over to a new MacBook Air (10.8) and a 64-bit project that compiled before gives me Shell Script Invocation Error: /bin/sh failed with exit code 2
It looks like XCode 4.6 is failing on one of the intermediate files, saying unexpected EOF while looking for matching '"' in a file ending in .sh
Any ideas how to fix this?
Thank
Bill