How to compile NetHack on Windows 7?

I like NetHack and I want to chat with the source a bit for fun. Before I do this, I would like him to be able to compile it out of the box, but I don't have so many difficulties for this to happen.

I downloaded the source code from here , and I followed the instructions here , but that didn't work.

As a result, I got the following

C:\nethack-3.4.3\src>mingw32-make -f Makefile.gcc install
creating directory o
gcc -c -mms-bitfields -I../include  -g -DWIN32CON -oo/makedefs.o ../util/makedefs.c
gcc -c -mms-bitfields -I../include  -g -DWIN32CON -DDLB   -oo/monst.o  ../src/monst.c
gcc -c -mms-bitfields -I../include  -g -DWIN32CON -DDLB   -oo/objects.o      ../src/objects.c
..\util\makedefs -v
Makefile.gcc:655: recipe for target '../include/date.h' failed
mingw32-make: *** [../include/date.h] Error -1073741819

I looked at the line that I was talking about, but actually did not say anything. I noticed that the date.h file created in the include directory is always empty, but that doesn't help much either. I read Install.nt README, and the directions seemed pretty clear. However, since I did not change anything, I do not know why he could not compile ...

, , make C , . MinGW... , , MinGW .

?

EDIT. date.h:

#
#  date.h should be remade every time any of the source or include
#  files is modified.
#

$(INCL)/date.h $(OPTIONS_FILE): $(U)makedefs.exe
    $(subst /,\,$(U)makedefs -v)

, , , - OPTIONS_FILE, , , . , .

#$(OPTIONS_FILE): $(U)makedefs.exe
#$(subst /,\,$(U)makedefs -v)

2 . , / date.h? , ? Google...

3 , " t ...

4 - Makedefs, , , . C, , -, :

void
do_date()
{
    long clocktim = 0;
    char *c, cbuf[60], buf[BUFSZ];
    const char *ul_sfx;

    filename[0]='\0';
#ifdef FILE_PREFIX
    Strcat(filename,file_prefix);
#endif
    Sprintf(eos(filename), INCLUDE_TEMPLATE, DATE_FILE);
    if (!(ofp = fopen(filename, WRTMODE))) {
        perror(filename);
        exit(EXIT_FAILURE);
    }
    Fprintf(ofp,"/*\tSCCS Id: @(#)date.h\t3.4\t2002/02/03 */\n\n");
    Fprintf(ofp,Dont_Edit_Code);

#ifdef KR1ED
    (void) time(&clocktim);
    Strcpy(cbuf, ctime(&clocktim));
#else
    (void) time((time_t *)&clocktim);
    Strcpy(cbuf, ctime((time_t *)&clocktim));
#endif
    for (c = cbuf; *c; c++) if (*c == '\n') break;
    *c = '\0';  /* strip off the '\n' */
    Fprintf(ofp,"#define BUILD_DATE \"%s\"\n", cbuf);
    Fprintf(ofp,"#define BUILD_TIME (%ldL)\n", clocktim);
    Fprintf(ofp,"\n");
#ifdef NHSTDC
    ul_sfx = "UL";
#else
    ul_sfx = "L";
#endif
    Fprintf(ofp,"#define VERSION_NUMBER 0x%08lx%s\n",
        version.incarnation, ul_sfx);
    Fprintf(ofp,"#define VERSION_FEATURES 0x%08lx%s\n",
        version.feature_set, ul_sfx);
#ifdef IGNORED_FEATURES
    Fprintf(ofp,"#define IGNORED_FEATURES 0x%08lx%s\n",
        (unsigned long) IGNORED_FEATURES, ul_sfx);
#endif
    Fprintf(ofp,"#define VERSION_SANITY1 0x%08lx%s\n",
        version.entity_count, ul_sfx);
    Fprintf(ofp,"#define VERSION_SANITY2 0x%08lx%s\n",
        version.struct_sizes, ul_sfx);
    Fprintf(ofp,"\n");
    Fprintf(ofp,"#define VERSION_STRING \"%s\"\n", version_string(buf));
    Fprintf(ofp,"#define VERSION_ID \\\n \"%s\"\n",
        version_id_string(buf, cbuf));
    Fprintf(ofp,"\n");
#ifdef AMIGA
    {
    struct tm *tm = localtime((time_t *) &clocktim);
    Fprintf(ofp,"#define AMIGA_VERSION_STRING ");
    Fprintf(ofp,"\"\\0$VER: NetHack %d.%d.%d (%d.%d.%d)\"\n",
        VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL,
        tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900);
    }
#endif
    Fclose(ofp);
    return;
}

, , : enter image description here

, ( ?) makedefs, , , , ?

EDIT 5. Makedefs.c. Makefile, , , , , , , .

$(U)makedefs.exe: $(MAKEOBJS)
    @$(link) $(LFLAGSU) -o$@ $(MAKEOBJS)

$(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \
     $(INCL)/objclass.h $(INCL)/monsym.h $(INCL)/qtext.h \
     $(INCL)/patchlevel.h $(U)makedefs.c $(O)obj.tag
    $(cc) $(CFLAGSU) -o$@ $(U)makedefs.c

, $(*) Makefile .

$(U) $(UTIL)/, $(UTIL) ../util. $(MAKEOBJS) $(O)makedefs.o $(O)monst.o $(O)objects.o. $(O) $(OBJ)/, o, $(O)makedefs.o , o/makedefs.o, , , - ( ).

$(link) gcc. $(LFLAGSU) $(LFLAGSBASEC), $(linkdebug), -g.

$(CONFIG_H) :

CONFIG_H = $(INCL)/config.h $(INCL)/config1.h $(INCL)/tradstdc.h \
           $(INCL)/global.h $(INCL)/coord.h $(INCL)/vmsconf.h \
           $(INCL)/system.h $(INCL)/unixconf.h $(INCL)/os2conf.h \
           $(INCL)/micro.h $(INCL)/pcconf.h $(INCL)/tosconf.h \
           $(INCL)/amiconf.h $(INCL)/macconf.h $(INCL)/beconf.h \
           $(INCL)/ntconf.h $(INCL)/nhlan.h

$(INCL) ../include. $(CFLAGSU) $(CFLAGSBASE) $(WINPFLAG).   $(CFLAGSBASE) -c $(cflags) -I$(INCL) $(WINPINC) $(cdebug)      $(cflags) -mms-bitfields      $(WINPINC) -I$(WIN32)          $ (WIN32) ../win/win32      $(cdebug) -g   $(WINPFLAG) -DTILES -DMSWIN_GRAPHICS -D_WIN32_IE=0x0400., . , , , RossRidge -D_USE_32BIT_TIME_T.

, , , . $(U)makedefs.exe :. , ? ? , @ $(link) $(LFLAGSU) -o$? $ -o?

, , , , . ... Aaaand -D_USE_32BIT_TIME_T WINPFLAG .

FINAL (ish) EDIT:, RossRidge -D_USE_32BIT_TIME_T. . Makefile.gcc, , 165 ( IF). -D_USE_32BIT_TIME_T. 176, ELSE IF. , ( , , , , ):

################################################
#                                              #
# Nothing below here should have to be changed.#
#                                              #
################################################

ifeq  "$(GRAPHICAL)" "Y"
WINPORT  = $(O)tile.o $(O)mhaskyn.o $(O)mhdlg.o \
    $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
    $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \
    $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o
WINPFLAG   = -DTILES -DMSWIN_GRAPHICS -D_WIN32_IE=0x0400 -D_USE_32BIT_TIME_T
NHRES   = $(O)winres.o
WINPINC = -I$(WIN32)
WINPHDR = $(WIN32)/mhaskyn.h $(WIN32)/mhdlg.h $(WIN32)/mhfont.h \
    $(WIN32)/mhinput.h $(WIN32)/mhmain.h $(WIN32)/mhmap.h \
    $(WIN32)/mhmenu.h $(WIN32)/mhmsg.h $(WIN32)/mhmsgwnd.h \
    $(WIN32)/mhrip.h $(WIN32)/mhstatus.h \
    $(WIN32)/mhtext.h $(WIN32)/resource.h $(WIN32)/winMS.h
WINPLIBS =  -lcomctl32 -lwinmm
else
WINPORT = $(O)nttty.o
WINPFLAG= -DWIN32CON -D_USE_32BIT_TIME_T
WINPHDR =
NHRES   = $(O)console.o
WINPINC =
WINPLIBS = -lwinmm
endif
+4
1

( , , , indiv, .)

indiv, makedefs.exe , ctime NULL. , ctime , , , . MinGW , Microsoft Visual ++. , MinGW C, Microsoft.

Visual Studio C ctime, :

. NULL , :

  • , 1 1970 , UTC.
  • _ctime32 _wctime32, 03:14:07 19 2038 .
  • _ctime64 _wctime64, 23:59:59, 31 , 3000, UTC.

, . ctime ? , long time_t . . Nethack - , Unix long , time_t , . Nethack , time_t .

, Nethack , , ctime. , ctime, _ctime32 _ctime64 . time_t - 64- , long . Windows long 32 , , ctime , , . , , :

ctime - , _ctime64, time_t __time64_t. time_t 32- time_t, _USE_32BIT_TIME_T. , ctime _ctime32. , 18, 2038, 64- .

, _USE_32BIT_TIME_T , C, MinGW C, , MinGW . MinGW time.h , , -D_USE_32BIT_TIME_T .

+4

All Articles