再求救:关于Borland C++的一个初级问题
我用的是Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
编译时出现了一个错误,Error E2133: Unable to execute command 'ilink32.exe'
而且之前跳出来windows错误报告,说T"urbo Incremental Linker 遇到问题需要关闭。我们对此引起的不便表示抱歉"。
我以前编译其他windows文件的时候也出现过类似的错误....
用g++ -mwindows Window1.cpp -o Window1编译,编译正确,产生Window1应用程序,但是我双击的时候,没反映,没窗口跳出,在任务管理器中有这个进程......
#define STRICT
#include <windows.h>
#include<windowsx.h>
#pragma warning(disable:4068)
#pragma warning(disable:4100)
/* Make the class name into a global variable */
static char szClassName[ ] = "Windows1";
static HWND MainWindow;
/* Declare Windows procedure */
LRESULT CALLBACK WndProc(HWND hWindow, UINT Message, WPARAM wParam, LPARAM lParam);
BOOL Register(HINSTANCE hInst);
HWND Creat(HINSTANCE hInst,int nCmdShow);
int PASCAL WinMain (HINSTANCE hInst,
HINSTANCE hPrevInstance,
LPSTR lpszCmdParam,
int nCmdShow)
{
MSG Msg; /* Here messages to the application are saved */
if(!hPrevInstance)
if (!Register(hInst))
return FALSE;
//if(! (hWindow=Create(hInst,nCmdShow)))
//return FALSE;
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&Msg, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&Msg);
/* Send message to WindowProcedure */
DispatchMessage(&Msg);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return Msg.wParam;
}
/*Register the Window*/
BOOL Register(HINSTANCE hInst)
{
WNDCLASS WndClass; /* Data structure for the windowclass */
/* The Window structure */
WndClass.hInstance = hInst;
WndClass.lpszClassName = szClassName;
WndClass.lpfnWndProc =WndProc; /* This function is called by windows */
WndClass.style =CS_HREDRAW|CS_VREDRAW;
// WndClass.cbSize = sizeof (WNDCLASS);
/* Use default icon and mouse-pointer */
WndClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
//WndClass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
WndClass.lpszMenuName = NULL; /* No menu */
WndClass.cbClsExtra = 0; /* No extra bytes after the window class */
WndClass.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
WndClass.hbrBackground =GetStockBrush(WHITE_BRUSH);
/* Register the window class, and if it fails quit the program */
return RegisterClass (&WndClass);
}
/* create the window*/
HWND Creat(HINSTANCE hInstance,int nCmdShow)
{
HWND hWindow = CreateWindow (
// 0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
if(hWindow==NULL)
return hWindow;
/* Make the window visible on the screen */
ShowWindow (hWindow, nCmdShow);
UpdateWindow(hWindow);
return hWindow;
}
#define Window1_DefProc DefWindowProc
void Window1_OnDestroy(HWND hwnd);
/* This function is called by the Windows function DispatchMessage() */
//LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK WndProc(HWND hWindow, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message) /* handle the messages */
{
HANDLE_MSG(hWindow,WM_DESTROY,Window1_OnDestroy);
default: /* for messages that we don't deal with */
return Window1_DefProc(hWindow, Message, wParam, lParam);
}
}
#pragma argsused
void Window1_OnDestroy(HWND hwnd)
{
PostQuitMessage(0);
}
问题点数:20、回复次数:5Top
1 楼liudong1982()回复于 2006-03-04 11:22:40 得分 0
请问高版本的bcc32,Ilink.exe能在哪下到啊?
Top
2 楼liudong1982()回复于 2006-03-04 11:24:31 得分 0
大哥帮帮我啊,我这个问题好久了,刚开始学 windows编程,这个都没编译成功......
我的qq:66863707,哪为高手加我,教教我啊.....Top
3 楼dragonhux(dragon(清水))回复于 2006-03-04 15:30:10 得分 0
换vc或者bcb,Borland C++ 5.5.1太早了,而且从BC 3.1以上就不稳定了。
你的程序在vc和bcb下面一样是可以编译运行的Top
4 楼alloutoflove(andrew)回复于 2006-03-04 15:43:59 得分 0
不是编译器的问题,是你的代码问题.Top
5 楼alloutoflove(andrew)回复于 2006-03-04 15:45:50 得分 20
//if(! (hWindow=Create(hInst,nCmdShow)))
//return FALSE;
你这里都屏蔽掉了, 还怎么出窗口=_=Top




