添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
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

make file_name - returns: CreateProcess(NULL, cc hello.c -o hello, ...) failed. make (e=2): The system cannot find the file specified. ERROR

Ask Question

I am new to c language and I am trying to compile my first program, following a tutorial.

My file hello.c :

#include <stdio.h>
int main(void)
  printf("hello, world\n");

I use "make hello" command to compile it but I get the error:

cc     hello.c   -o hello
process_begin: CreateProcess(NULL, cc hello.c -o hello, ...) failed.
make (e=2): The system cannot find the file specified.
<builtin>: recipe for target 'hello' failed
make: *** [hello] Error 2

I have MinGW installed and I have it in my environment variables PATH. I am trying it on Windows 8.

Please any help I would very appreciate. Maybe there is another way to compile a c files?

If you run cc directly, does it work? If not, you need to make sure that make will use the correct compiler. (Or install one if you haven't) – Thomas Jager Mar 2, 2022 at 21:04 Thomas, thanks for your comment! I tried to run "cc" but it is not a recognized command. Would you please recommend me any compiler? – N.Nicko Mar 2, 2022 at 21:35 It's been a bit since I've used MinGW, but I think that depends on how you installed it. If you're using MSYS2, then it'd be something like pacman -S --needed base-devel mingw-w64-x86_64-toolchain in the shell. – Thomas Jager Mar 2, 2022 at 21:55

MinGW is actually a gcc compiler. So the C compiler is invoked with gcc instead of cc. Try running this command:

make hello CC=gcc
        

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.