main.cpp
#include <afxwin.h> class CMyApp : public CWinApp { public: BOOL InitInstance() { AfxMessageBox("Hello, world!"); return FALSE; } }; CMyApp myApp;
main.mak
OUTDIR = Debug TARGET = main CPP = cl.exe CXXFLAGS = /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /GZ /c LD = link.exe LDFLAGS = /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /pdbtype:sept OBJS = "$(OUTDIR)\$(TARGET).obj" all: if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" $(CPP) $(CXXFLAGS) $(TARGET).cpp $(LD) $(LDFLAGS) $(OBJS) clean: rmdir /s /q $(OUTDIR)
編譯、執行
$ export WINEPREFIX=/home/user/.wine_x86 $ box86 wine nmake -f main.mak clean $ box86 wine nmake -f main.mak $ box86 wine Debug/main.exe
完成