Make file Not Working

Hello! I just got my book and trying to run ex1 make file.

I get the following error:

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

When I go to check the compiler with the gcc -v command, I get the following:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/Program\ Files\ (x86)/Dev-Cpp/MinGW64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 4.9.2 (tdm64-1)

I’m not sure what I’m doing wrong.

Can you show the make file and your directory?
Have you tried changing the order of the compiler args? Try cc -o ./ex1 ./ex1.c, just to make sure that’s not the issue.
What’s your setup, mingw-32 on Windows?

Thank you for replying @florian.

When I try cc -o ./ex1 ./ex1.c, it does not recognize the command cc.

I thought my set up is Mingw-64 on Windows but my make file says 32.

My make file is mingw32-make.exe. The director is: C:\Program Files (x86)\Dev-Cpp\MinGW64\bin.

When I try the command minw32-make.exe -o ./ex1 I get

mingw32-make.exe: *** No targets specified and no makefile found. Stop.

When I add the ./ex1.c I get

mingw32-make.exe: Nothing to be done for 'ex1.c'.

`

Hmm but I presume you have some sort of a Makefile, right? Can you show the content?

I’m afraid I don’t know what to suggest here. I’ve never used mingw. Hopefully @zedshaw can help.

Is the .exe not what you meant? My apologies as I’m a python guy and a hacker at that. This is all new to me.

Oh, now I see, my bad. You don’t use Makefiles at that point yet.
Dumb question: You are in the directory where your c file is located, right?

Yes. I made sure of that before I posted.

I don’t know if this will work but try using make.exe instead of mingw32-make.exe.

I tried that and got the following:

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

If you don’t get it to work with mingw I encourage you to try running Ubuntu on the Windows subsystem for Linux. I think that’s a much better option now that wasn’t available when the book was written.

Also, Visual Studio comes with a native C/C++ compiler for Windows. You could check out Visual Studio build tools. But beware that this will be a very different environment with a bit of an additional learning curve.

Thanks. I know I can get Dev C++ to compile. I was just trying to not use an IDE like the preface suggested. I’ll continue the book with that unless/until I come to a place I can’t use it. Thanks for sticking with me through the conversation.

FWIW you can use just the compiler, the build tools are a much smaller package than the full IDE. See here: