简体   繁体   中英

C program is not running on Visual Studio Code

[Image][1]I am using an Ubuntu machine. I want to run C program on Visual Studio code. I have installed C/C++ extension and CODE RUNNER extension to my VS Code. But when I am going to run a simple program, it is showing me errors. What should I do now?

tony@Jarvis:~/Desktop/c program$ cd "/home/tony/Desktop/c program/" &&
gcc Hello World.c -o Hello World && "/home/tony/Desktop/c program/"Hello World

gcc: error: Hello: No such file or directory

gcc: error: World.c: No such file or directory

gcc: error: World: No such file or directory

gcc: fatal error: no input files

compilation terminated.

Your file name should not contain any spaces. I see Hello World.c . This will not work. Try changing it to HelloWorld.c

Your file name has spaces, Hello World.c . Having spaces while using a Command Line too like gcc is not good. Stay away from spaces as much as you can. In this case gcc thinks that Hello and World.c are separate files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM