标题:菜鸟问题,程序在vc++6.0下不能执行
只看楼主
cfnxy
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2007-2-17
 问题点数:0 回复次数:0 
菜鸟问题,程序在vc++6.0下不能执行

//The project file is FRAME.IDE
//Source file is FRAME.C
//The framework of Windows 98 Applicationhas no
//resource file, header file, and definition file
#include "windows.h"

LRESULT CALLBACK WindowFunc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
char szWinName [] = "MyWin";
int WINAPI WinMain (HINSTANCE hThisInst, HINSTANCE hPrevinst, LPSTR IpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASS wcl;

wcl.hInstance = hThisInst;
wcl.lpszClassName = szWinName;
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon (NULL,IDI_APPLICATION);
wcl.hCursor = LoadCursor (NULL,IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH);

if (! RegisterClass (&wcl) ) return 0;

hwnd = CreateWindow (
szWinName,
"试验",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);

ShowWindow (hwnd, nWinMode);
UpdateWindow (hwnd);

while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}

LRESULT CALLBACK WindowFunc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp2.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

这是书中的例子,在集成开发环境7.4下却可以执行,这是怎么回事?

搜索更多相关主题的帖子: definition framework Windows message include 
2007-03-17 08:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-124751-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.143255 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved