# Talk:Patching
Can someone please expand on this?  As a windoze programmer I have never used patch and am trying to apply the vs2005 patch and it keeps failing and I do not understand why...
missing header for context diff at line 13 of patch

I assume you're speaking of this patch. I unpacked nethack's sources, and downloaded the vc2005-file in the source root directory, and typed
patch -p0 &lt; vc2005

in the command line, which seems to work ok for me, but I'm on linux... Haven't tried compiling nethack with that patch either. --Paxed 14:59, 19 July 2007 (UTC)

Using cygwin helps. I tried using a windows binary of patch, but that didn't work too well. I eventually installed cygwin and used that to apply a patch (menucolors) and it worked.Addps4cat 13:31, 7 September 2007 (UTC)
Contents

1 Now what?
2 What?
3 Great tutorial, but...
4 How???
5 Thoughts on expanding this article, help for source-diving newbies

Now what?
Well everything went all right, except that none of the patches still took any effect. I concluded that they'd have no way of knowing where my SLASH'EM is, so I copy-pasted all them files to the source directory. Still no effect.
What did I do wrong?

What?
I'd like to use this moment to say: WHAT?! This instruction is completely incomprehensible! 
"note: On MS-Windows, the patchfile must be a text file, i.e. CR-LF must be used as line endings. A file with LF may give the error: "Assertion failed, hunk, file patch.c, line 343," unless the option '--binary' is given." 
What's the patchfile? What does CR-LF mean? What does "line ending" mean? What option "--binary"? What the hell is going on here? I know that the majority of NetHack players are Computer geeks, but you don't have to make it even harder for normal people than it already is! 
MC-Dirty 12:27, 31 July 2009 (UTC)

Great tutorial, but...
I've followed the compile article to the letter and vanilla NH complies just fine. I've followed this one as well, but I get this message when I try to compile:
Linking....
o/wintty.o: In function `get_menu_coloring':
c:\nh343\src/../win/tty/wintty.c:1146: undefined reference to `_imp__regexec'
o/options.o: In function `add_menu_coloring':
c:\nh343\src/../src/options.c:1071: undefined reference to `_imp__regcomp'
c:\nh343\src/../src/options.c:1074: undefined reference to `_imp__regerror'
o/save.o: In function `free_menu_coloring':
c:\nh343\src/../src/save.c:969: undefined reference to `_imp__regfree'
collect2: ld returned 1 exit status
mingw32-make: *** [../binary/NetHack.exe] Error 1
Can anyone help? I'm trying to make a menucolors+statuscolors version. The one I found linked on the patch database wasn't compiled with autopickup exceptions...
-Tekuromoto 17:31, 24 May 2011 (UTC)

How???
After I start "patch.exe -p1 &lt; file", the only thing tat came out was this blank cmd screen.What went wrong??I'm am using Win7.--WillyPillow (talk) 09:54, 19 July 2012 (UTC)

Windows 7 (and Vista) require administrative privileges to run any file with "patch" in the name, this breaks the "patch.exe -p1 &lt; file" command. This works as a workaround:
1.  Rename patch.exe to patsh.exe.
2.  Then create patch.bat in the same directory containing the following command:
@patsh.exe&nbsp;%*
http://jameswynn.com/2010/03/gnu-patch-in-windows-7-or-vista/
--86.156.170.102 23:56, 30 November 2013 (UTC)

Thoughts on expanding this article, help for source-diving newbies
I'm considering applying "stub" to this article, because it seems like we can do a lot to expand it. I don't know enough about modifying the source code to do it myself. In particular, it seems like these two big areas aren't being considered in this article:

Patching on non-Windows operating systems
Building a diff file (thus creating, rather than applying a patch)
The second point is a big one because even though we have a page on diff I can't find any tutorials on how to use it, and when I tried using rdiff in cygwin it threw back an error because it's only useful for individual files and not directories. I'm understandably annoyed because this means rdiff is useless for larger projects.
For an open-source project, you'd think there would be a lot more documentation on modifying NetHack's source code. - Crawldragon (talk|nao|wiki) 16:55, 19 October 2014 (UTC)