I got it to build and run using the following modified version of makefile.vc:
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
INCLUDEPATHS= \
/I"C:\bitcoin-build\boost_1_46_1" \
/I"C:\bitcoin-build\db-4.7.25\build_windows" \
/I"C:\bitcoin-build\openssl-1.0.0d\include" \
/I"C:\bitcoin-build\wxWidgets-2.9.1\lib\vc_lib\mswu" \
/I"C:\bitcoin-build\wxWidgets-2.9.1\include" \
/I"C:\bitcoin-build\miniupnpc-1.5.20110215"
LIBPATHS= \
/LIBPATH:"C:\bitcoin-build\boost_1_46_1\stage\lib" \
/LIBPATH:"C:\bitcoin-build\db-4.7.25\build_windows\Release" \
/LIBPATH:"C:\bitcoin-build\openssl-1.0.0d\out32dll" \
/LIBPATH:"C:\bitcoin-build\wxWidgets-2.9.1\lib\vc_lib" \
/LIBPATH:"C:\bitcoin-build\upnpc-exe-win32-20110215" \
/NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib \
/NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib \
/NODEFAULTLIB:msvcrtd.lib
WXLIBS=wxmsw29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
LIBS= \
libboost_system-vc100-mt.lib \
libboost_filesystem-vc100-mt.lib \
libboost_program_options-vc100-mt.lib \
libboost_thread-vc100-mt.lib \
libdb47s.lib \
libeay32.lib \
miniupnpc.lib \
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
DEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH /DNOMINMAX /DUSE_UPNP
DEBUGFLAGS=/Os
CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
OBJS= \
obj\util.obj \
obj\script.obj \
obj\db.obj \
obj\net.obj \
obj\irc.obj \
obj\main.obj \
obj\rpc.obj \
obj\init.obj
CRYPTOPP_OBJS= \
cryptopp\obj\sha.obj \
cryptopp\obj\cpu.obj
all: bitcoin.exe
.cpp{obj}.obj:
cl $(CFLAGS) /DGUI /Fo$@ %s
obj\util.obj: $(HEADERS)
obj\script.obj: $(HEADERS)
obj\db.obj: $(HEADERS)
obj\net.obj: $(HEADERS)
obj\irc.obj: $(HEADERS)
obj\main.obj: $(HEADERS)
obj\rpc.obj: $(HEADERS)
obj\init.obj: $(HEADERS)
obj\ui.obj: $(HEADERS)
obj\uibase.obj: $(HEADERS)
cryptopp\obj\sha.obj: cryptopp\sha.cpp
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
cryptopp\obj\cpu.obj: cryptopp\cpu.cpp
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
obj\ui.res: ../share/ui.rc ../share/pixmaps/bitcoin.ico ../share/pixmaps/check.ico ../share/pixmaps/send16.bmp ../share/pixmaps/send16mask.bmp ../share/pixmaps/send16masknoshadow.bmp ../share/pixmaps/send20.bmp ../share/pixmaps/send20mask.bmp ../share/pixmaps/addressbook16.bmp ../share/pixmaps/addressbook16mask.bmp ../share/pixmaps/addressbook20.bmp ../share/pixmaps/addressbook20mask.bmp
rc $(INCLUDEPATHS) $(DEFS) /Fo$@ %s
bitcoin.exe: $(OBJS) $(CRYPTOPP_OBJS) obj\ui.obj obj\uibase.obj obj\ui.res
link /nologo /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS)
.cpp{obj\nogui}.obj:
cl $(CFLAGS) /Fo$@ %s
obj\nogui\util.obj: $(HEADERS)
obj\nogui\script.obj: $(HEADERS)
obj\nogui\db.obj: $(HEADERS)
obj\nogui\net.obj: $(HEADERS)
obj\nogui\irc.obj: $(HEADERS)
obj\nogui\main.obj: $(HEADERS)
obj\nogui\rpc.obj: $(HEADERS)
obj\nogui\init.obj: $(HEADERS)
bitcoind.exe: $(OBJS:obj\=obj\nogui\) $(CRYPTOPP_OBJS) obj\ui.res
link /nologo /OUT:$@ $(LIBPATHS) $** $(LIBS)
clean:
-del /Q obj\*
-del /Q obj\nogui\*
-del /Q cryptopp\obj\*
-del /Q *.ilk
-del /Q *.pdb
If you use this, you'll want to set INCLUDEPATHS and LIBPATHS to your own library locations.
The changes I made are:
- Updated location of resources used to build ui.res.
- Moved list of CryptoPP objects from OBJ to its own CRYPTOPP_OBJ since they don't have seperate nogui versions.
- Added MiniUPnP library and USE_UPNP define.
- Added NOMAXMIN define to remove certain incompatible macros.
Also, for wxWidgets, make sure you either edit config.vc to make a release build before building, or modify this makefile to use the default debug build.
Edit: Spoke too soon. After running for a few seconds, my Bitcoin build is being terminated by DEP. This applies to both bitcoin.exe and bitcoind.exe.
I'll look into this more later.It appears the issue was with MiniUPnP. I have been completely unsuccessful of making my own build of miniupnpc.lib using VC, so I built it without UPnP entirely. In order to build Bitcoin without USE_UPNP defined, I had to make a small modification to net.cpp by added the following lines after the MapPort function:
#else
void MapPort(bool fMapPort) {}
This gives a us MapPort function to use when USE_UPNP is not defined.
More Edit: D'oh! I forgot to copy the MiniUPnP DLL to the same directory as bitcoin.exe when using the prebuilt MiniUPnP. That solves the DEP issue.