views:

190

answers:

5

Can someone provide a HelloWorld demo ?

+1  A: 

Easiest way is to install cygwin and use a normal makefile.

Paul R
+1  A: 

if you are using visual studio - the CSPROJ is the make file - you can try to view it in an editor. with other compilers - you need to check...

Dani
+1  A: 

Some good information available here.

There's an nmake tutorial available here (nmake is what comes with visual studio).

Is there something more specific you're trying to do? It would help get a better answer. Are there some specific differences with Windows that concern you?

Nader Shirazie
NB nmake is rarely used in practice. It's not compatible with other platform's make tools, and if you only want to target windows it's much easier to use Visual Studio in the normal way. If you want to learn about makefiles as they are actually widely used, don't use nmake.
Daniel Earwicker
Fair enough. I've only ever used it for simple stuff, to avoid downloading a separate tool.
Nader Shirazie
Visual studio project files change with every version of VS. Makefiles are a much more version tolerant solution. I've worked for two different Windows-only development houses that use NMAKE for all official builds, so it's not at all rare in my _personal_ experience.
John Knoeller
+3  A: 

If you know about makefiles but are trying to cope with the lack of tools on a default Windows install:

Get cygwin.

If you want to learn about makefiles:

This is actually quite a complex question. Firstly for hello world, you wouldn't need linking of several files, so the makefile could be simplified, but then wouldn't teach you what you need to know.

In a real program you need to link several files, you need to use makefile variables to reduce repetition, etc. So a short example would contain a bunch of stuff with no apparent purpose. So what you need is a good tutorial.

This one is pretty good. Jump in at that page but keep reading, as the stuff on the first page is not the maintainable approach (though it is necessary to know about it).

If you just want to write Windows programs:

Don't bother with makefiles. Use Visual Studio project files and a solution file to tie them together. Most open source projects seem to distribute VS project files for Windows (if anything) and use gnu make for other platforms. Visual Studio is available in a free "Express" edition.

Daniel Earwicker
A: 

If you want to develop Windows applications (as opposed to Posix ones as supported by the bloated Cygwin) from the command line, the best solution is to get the MinGW port of GCC from Twilight Dragon, and the MSYS port of the standard GNU tools such as make. You should also get a copy of the GNU make manual, which is also an excellent tutorial.

anon
Is there a chm version of GNU make manual?
@user198729 Not that I'm aware of. What's wrong with HTML?
anon