Warm tip: This article is reproduced from serverfault.com, please click

Creating Makefile on Windows

发布于 2020-11-27 20:37:26

I have a project that make some processing on circular double linked List. I must use this project files in different directories and I made this project but I couldn't create a Makefile for Windows.

My success commands that I use on Command Prompt as shown below;

g++ -c src\Demo.cpp -o lib\Demo.o
g++ -c src\CircularDoubleLinkedListProcessor.cpp -o lib\CircularDoubleLinkedListProcessor.o
g++ -c src\CircularDoubleLinkedList.cpp -o lib\CircularDoubleLinkedList.o

g++ lib\Demo.o lib\CircularDoubleLinkedListProcessor.o lib\CircularDoubleLinkedList.o -o bin\Demo.exe

.\bin\Demo.exe

Also, this project's class diagram:

Demo -> CircularDoubleLinkedListProcessor -> CircularDoubleLinkedList -> DoubleLinkedListNode

File Hierarchy:

enter image description here

I would be very grateful, if you could help me

Questioner
S.Balaban
Viewed
0
S.Balaban 2020-11-28 19:27:10

I found the solution, we can easily use it similar to the Linux environment. I was confused looking at some samples.

makefile

ALL:
    g++ -c src\Demo.cpp -o lib\Demo.o
    g++ -c src\CircularDoubleLinkedListProcessor.cpp -o lib\CircularDoubleLinkedListProcessor.o
    g++ -c src\CircularDoubleLinkedList.cpp -o lib\CircularDoubleLinkedList.o

    g++ lib\Demo.o lib\CircularDoubleLinkedListProcessor.o lib\CircularDoubleLinkedList.o -o bin\Demo.exe

    .\bin\Demo.exe

Command:

> mingw32-make