Yes install mingw or cygwin as neo told. Cygwin would be my choice because it's not minimalistic like mingw. But if you concern the space used and the download bandwidth then it's oky to chose mingw. Mingw means minimalistic.
And this is how I compile using the mingw or cygwin prompt.
1. Make an empty Makefile.
then to make a single executable from a file. for a example you got first.c like bellow.
Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char ** argv)
{
printf("hello World.\n");
return 0;
}
So just to compile your first.c you just only need to command ,
Where Make have built in rules so Make is smart enough to figure out the it for you.
And to make the executable,
The make will build the executable out of first.c invoking the correct command line.
When your executable does build from more than one source module, then you may use $(OBJS). Bellow is an example Makefile.
Code: Select all
.PHONEY: textedit.exe
LINK:=gcc
OBJS:=keyboard.o parser.o main_window.o mouse.o about_dialog.o
textedit.exe: $(OBJS)
$(LINK) -o $@ $^
Suppose that you need to build textedit.exe executable.
You could also use $CFLAGS to pass compile time flags, and $LDFLAGS to pass different link flags for a example,recently I was needed to link with openssl library to build specific executable in my project called 'md5_password_gen'.[In linux you could see there is no extension to the executable].And bellow is how it's line look like.
Code: Select all
md5_password_gen: LDFLAGS+= -lssl
md5_password_gen: md5_password_gen.o
$(CPP) $(LDFLAGS) $^ -o $@
Where you could see that I've override the LDFLAGS variable for a specific rule.Where libssl would only be linked with the 'md5_password_gen' program, but not with the main program in the project.
Make is a tool and please feel free on using it. No matter you need to compile a single file for a test case you could use Make.And recursive make would invoke in the ./test directory Makefile recursively and link it with the test program.
It's like a powertool, where it make your life easy and quick. Use it but learn what it does behind the scene. IDE is also like that , there's no crime to use an IDE if you know what's going behind.
Good luck and thaks for your interest.