views:

258

answers:

1

Just shifted to windows7. Liking it :).
Is there a way to install MinGW in windows, such that, i can cd to my code directory (which is different from MinGW install directory) and compile my code there.
IF, no then what is the equivalent of $PATH (bourne shell) in windows, and how shall i set it. Can this trick (setting MinGW in default path of exe) work on windows7.

Any useful wiki's, blogs, forum would be very very helpful.

+2  A: 

It's perfectly possible, first thing you have to do is download MinGW (see (1) below for some suggestions). Then install it using the installer if you have one or just decompress the files in a directory (i.e.: D:\Tools\MinGW).

Now, set the PATH variable (Windows systems have it too) to point to the bin directory. To do so, go to Control Panel\System and Security\System and click in the Advanced system settings options in the left panel. There select Environmental Variables... and find it in the System variables list.

Note that in Windows the separator among the directories placed in the PATH variable is a ; instead of a :.

And you're all set, whatever is on a directory on the PATH should be accessible from the command line. Instead of using the system-wide PATH you may also create a PATH user variable, it's up to you.

To access an environmental variable from the command line you use %s (i.e.: echo %PATH%). Using the command set without parameters in a command line should display the current environment variables. You can use it to set the value of one too (i.e.: set LIBPATH=D:\Code\Libraries).

(1). You may download it from several places: the original MinGW project (which has an installer too), TDM builds (also with an installer), MinGW-w64 (for 64-bit systems, but has toolchains targeting 32-bit too, also binaries for the 4.5 branch of GCC), ...

Xandy
:D thanks man i am happy. do you know about virtualbox too. if yes i have some questions, i couldnot find help anywhere. :D. thanks a lot. added my gvim and gcc now i can code in windows too the way i want.
Vivek Sharma
I do, but questions regarding VirtualBox and that sort of things (unless it's a VBox coding thing) should go in the SuperUser site (superuser.com). I'll try to answer them :)
Xandy