how to compile windows program in borland 5.5
how to compile windows program in borland 5.5
(OP)
My Borland 5.5 c++ compiler won't compile even a simple windows program. When I try the same program in VC++ it compiles ok.
The error I get in Borland is:
Error: Unresolved external '_main' referenced from C:\BORLAND\BCC55\LIB\C0X32.OBJ
what does this mean?
The error I get in Borland is:
Error: Unresolved external '_main' referenced from C:\BORLAND\BCC55\LIB\C0X32.OBJ
what does this mean?
RE: how to compile windows program in borland 5.5
int main()
{
//code here
return 0;
}
Then you need to compile your program as a 32bit windows console application.... Otherwise if it starts something like this:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE PrevInstance, LPSTR lpCmdLine, INT nCmdShow)
You just compile it as a normal 32bit windows application.
Kim_Christensen@telus.net
http://www3.bc.sympatico.ca/Kim_Christensen/index.html
RE: how to compile windows program in borland 5.5
#include <windows.h>
static char pClassName[] = "TheClass";
static HINSTANCE ghInst = 0;
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case CM_CLOSEWIN: DestroyWindow(hwnd); break;
case WM_CLOSE: DestroyWindow(hwnd); break;
case WM_DESTROY: PostQuitMessage(0); break;
default: return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wce;
HWND hwnd;
MSG msg;
ghInst = hInstance;
wce.cbSize = sizeof(WNDCLASSEX);
wce.style = 0;
wce.lpfnWndProc = WndProc;
wce.cbClsExtra = 0;
wce.cbWndExtra = 0;
wce.hInstance = ghInst;
wce.hIcon = LoadIcon(0, IDI_WINLOGO);
wce.hCursor = LoadCursor(0, IDC_ARROW);
wce.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wce.lpszMenuName = 0;
wce.lpszClassName = pClassName;
wce.hIconSm = LoadIcon(0, IDI_WINLOGO);
if(!RegisterClassEx(&wce))return 0;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, pClassName, "title", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
800, 600, 0, 0, ghInst, 0);
if(hwnd == 0) return 0;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
RE: how to compile windows program in borland 5.5
I use batch files. Below is a sample.
FIRST FILE TO COMPILE SOURCE C OR CPP
bcc32 -c -w- -tW wingen.cpp
SECOND TO COMPILE RC FILE
brcc32 -w32 myrsrce.rc
THIRD TO LINK OBJ AND RES *NOTE "iLink32" IS NOT A LINK BUT THE LINKER PROG
iLink32 -Tpe -aa c0w32.obj wingen.obj , wingen.exe, ,import32.lib cw32mt.lib, ,myrsrce.res
del *.ils
del *.ilf
del *.ilc
del *.ild
del *.tds
del *.map
DEL LINES TO GET RID OF INTERMEDIATE FILES
I put the deviders in CAPS to seperate the three files.
wingen.cpp is what I wrote to use as a template(NOT CPP template)for starting a windows program.
Hope this helps.
Pappy
You learn somrthing everyday.
RE: how to compile windows program in borland 5.5
bcc32 test.cpp
doesn't work for windows apps....
bcc32 -tW test.cpp
does.
so for example:
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine, int cmdShow)
{MessageBox(0, "ok", "ok", MB_OK); return 0;}
compiles and runs ok displaying a simple pop-up.
Thanks a bunch.
Thanks also zBuilder for responding.
RE: how to compile windows program in borland 5.5
James P. Cottingham
www.ivcusa.com
RE: how to compile windows program in borland 5.5
RE: how to compile windows program in borland 5.5