Reputation: 175
I want to compile my code using MakeFile in a Windows environment. I have created a Makefile in Linux but don't have any idea how to create and run in Windows. I have installed MinGW and also edited the environment variable path. I have tried running the Makefile like I was doing in a Linux environment, but I'm not able to run it. Can anyone please share any link.
This is my simple Makefile
CC = g++
all: Exe
Exe : main.o Hello.o
$(CC) -o Exe main.o Hello.o
main.o: main.cpp
$(CC) -c main.cpp
Hello.o: Hello.cpp
$(CC) -c Hello.cpp
clean:
rm -rf *o main.o Hello.o
I am running it from the command prompt make MakeFile and every time it prompts with the message, makefile up to date. It is not doing anything, not even generating an executable.
Upvotes: 3
Views: 37571
Reputation: 4478
The syntax is almost the same. It's really depend if you added specific command (like using find
, grep
, ...).
You should add the error reported by make
command to your question.
Without more information we cannot guess where is the problem
Edit: I did not understand that you do not find the make command. The make
command is sometime named mingw32-make.exe
. It's really depend which version and type of MinGW you installed
Edit2: The command line to type is make
(or mingw32-make.exe
) and not make Makefile
Take a look at the man of make
In the clean:
section, do not use rm
, this command does not exist on Windows
Upvotes: 4
Reputation: 1615
Goto bin directory in MinGW and check whether you have a file named make.exe if you don't have it then rename mingw32-make.exe to make.exe
As I remember normally make.exe is named mingw32-make.exe in the MinGW distribution, I don't know why they do so, but renaming it to make.exe can solve the problem in most of the cases.
Upvotes: 2