程式語言 - C++ Builder 6 - Visual Component Library (VCL) - Hello, world!



main.cpp

#include <vcl.h>

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    Application->Initialize();
    Application->MessageBox("Hello, world!", "main");
    return 0;
}

main.mak

TARGET   = main
OUTDIR   = Debug
CXX      = bcc32
LD       = ilink32
INC      = "$(BCB)\include";"$(BCB)\include\vcl"
CXXFLAGS = -c -I$(INC) -n$(OUTDIR)
LDFLAGS  = -L"$(BCB)\lib" -L"$(BCB)\lib\obj" -L"$(BCB)\lib\release"
LIBS     = import32.lib cp32mti.lib
OBJS     = c0w32.obj vcl.bpi rtl.bpi memmgr.lib sysinit.obj $(OUTDIR)\$(TARGET).obj

all:
	rmdir /s /q $(OUTDIR)
	mkdir $(OUTDIR)
	$(CXX) $(CXXFLAGS) $(TARGET).cpp
	$(LD) $(LDFLAGS) $(OBJS),$(OUTDIR)\$(TARGET).exe,,$(LIBS),,
	$(OUTDIR)\$(TARGET).exe

編譯、執行

$ export WINEPREFIX=/home/user/.wine_x86

$ box86 wine make -f main.mak

完成