Search code examples
ccs50

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


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.


Solution

  • 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).