I am a beginner learner of the C programming language. I just started learning this language, this year at the beginning of July. I am trying to learn the basics of C programming before going to university this September.
In order for me to run the C program, I tried to configure VS code to use the C/C++ compiler. I followed the steps on this website: https://code.visualstudio.com/docs/cpp/config-msvc
Everything was going well until the ‘Run helloworld.cpp’ section. When I hit run, following the instructions in the website, an error message, “ The preLaunchTask ‘C/C+ +: cl.exe build active file’ terminated with exit code -1’ ” appeared and wouldn’t let me run the code.
Then I realized, in the terminal tab below, another error is shown, ‘Link : fatal error LNK1104: cannot open file ’C:Users60122Desktopprojectshelloworldhelloworld.exe’ ’
Is there any way I can solve these two errors and successfully run my c program on VS code?
I would really appreciate it if you could help me with this.
Thank you
My attempts of solving the two errors
#Error 1: “ The preLaunchTask ‘C/C+ +: cl.exe build active file’ terminated with exit code -1’ ” appeared and wouldn’t let me run the code.
I searched the solutions for this error:
-
https://www.youtube.com/watch?v=H2lDskr1z-0&t=32s
This video told me to delete the ‘vscode’ folder on the explorer tab in VS code. However it didn’t work. -
https://www.youtube.com/watch?v=l8g8GvqMxHc&t=50s
This video told me to go on my file -> preferences -> setting, and check the ‘run in terminal’ section, but in my VS code, there’s no such option to be checked
#Error 2: ‘Link : fatal error LNK1104: cannot open file ’C:Users60122Desktopprojectshelloworldhelloworld.exe’
I searched solutions for this error, and came across this:
- Why does fatal error “LNK1104: cannot open file ‘C:Program.obj'” occur when I compile a C++ project in Visual Studio?
I think I am supposed to go to Configuration Properties -> Linker -> Input, and then change the file name. However, I can’t find the ‘Configuration properties’ on my VS code.
Jiyou Won is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.