相关文章推荐
沉着的太阳  ·  在 ...·  8 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

process_begin: CreateProcess(NULL, g++ Hello.C -o Hello, ...) failed. make (e=2): The system cannot find the file specified

Ask Question

I'm trying to make a file into a program on VScode with the Bash terminal, but it reports the above error. I'm relatively new to programming as a whole and trying to follow along with the CS50 course uploaded online; please forgive any incompetence.

below is the entire problem

$ make Hello CC=gcc
g++     Hello.C   -o Hello
process_begin: CreateProcess(NULL, g++ Hello.C -o Hello, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [<builtin>: Hello] Error 2
  • I installed Git and then downloaded chocolatey because I was missing the "make" cmd and I was then able to use the cmd but thats as far as I got before the aforementioned error showed up.

  • I've already made sure the file directory is correct in VScode via the explorer (Folder -> Hello.C)

  • I've been attempting this for a couple hours now and genuinely have no idea how to proceed; any advice is appreciated.

    I am under the assumption you are using Windows. Which is very likely your problem. Under Windows, C Compilers aren't preinstalled, and the compiler you are trying to use (GCC/G++) is a Linux exclusive. MinGW is the Windows equivalent.

    From personal experience, programming C under Windows is a hassle, so I can recommend you use WSL (Windows Linux Subsystem) and the corresponding VSCode extension, wich allows you to code in VSCode under Windows with the Terminal, Code and Filesystem running in Linux.

    If you were watching this Video, the Prof is using Github codespaces an online cloud service his code runs on (also Linux).

    Leaving this here so no one else gets tortured as I did; from what I can understand what I tried to do wouldn't have worked at all so using WSL is 1. Miles easier and 2. the only real option besides completely switching your OS to Linux or getting a cloud service – Vedelga5343 Nov 6, 2022 at 4:06 @Vedelga5343 You can also install a Compiler in Windows too, there are tutorials for that. But if you are learning I would do WSL because it's way easier to get into. (and you learn some your way around Linux too) – M Moto Nov 6, 2022 at 12:25

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

  •