| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 396 人关注过本帖
标题:连接错误
取消只看楼主 加入收藏
howema
Rank: 1
等 级:新手上路
帖 子:336
专家分:0
注 册:2005-10-4
结帖率:50%
收藏
 问题点数:0 回复次数:1 
连接错误

编了一个小程序,编译通过了,可是连接时出现错误,高手帮忙看看什么问题~
源代码如下
#include<windows.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInst,
LPSTR lpszCmdLine,
int nCmdShow)
{
HWND hwnd;
MSG Msg;
WNDCLASS wndclass;
char lpszClassName[]="映像模式";
char lpszTitle[]="My_Map_Mode";
wndclass.style=0;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=lpszClassName;

if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return FALSE;
}

hwnd=CreateWindow( lpszClassName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
310,
330,
NULL,
NULL,
hInstance,
NULL);

ShowWindow( hwnd,nCmdShow);
UpdateWindow(hwnd);

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

LRESULT CALLBACK WndProc(HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
HDC hdc;
static PAINTSTRUCT ps;
static HBRUSH hBl;
static HPEN hPl;
static int nMode;
static int flags=0;
static int nlbuttonx=0,nlbuttony=0;
int i=0;

switch(message){
case WM_CREATE:
flags=0;
nMode=MM_TEXT;
hBl=(HBRUSH)GetStockObject(BLACK_BRUSH);
break;

case WM_LBUTTONDOWN:
flags=1;
nMode=MM_ISOTROPIC;
nlbuttonx=LOWORD(lParam);
nlbuttony=HIWORD(lParam);
hBl=(HBRUSH)GetStockObject(BLACK_BRUSH);
InvalidateRect(hwnd,NULL,0);
break;
case WM_RBUTTONDOWN:
nMode=MM_ANISOTROPIC;
nlbuttonx=LOWORD(lParam);
nlbuttony=HIWORD(lParam);
hBl=CreateSolidBrush(RGB(0,255,0));
InvalidateRect(hwnd,NULL,0);
break;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
SetMapMode(hdc,nMode);
SetWindowExtEx(hdc,300,300,NULL);
SetWindowOrgEx(hdc,0,0,NULL);
SetViewportExtEx(hdc,300,300,NULL);
hPl=CreatePen(PS_INSIDEFRAME,2,RGB(125,125,125));

SelectObject(hdc,hPl);
SelectObject(hdc,hBl);

if(flags)
{
SetMapMode(hdc,nMode);

Ellipse(hdc,
(nlbuttonx/30)*30,
(nlbuttony/30)*30,
(nlbuttonx/30)*30+30,
(nlbuttonx/30)*30+30);
}
else
{
for(i=30;i<=300;)
{
MoveToEx(hdc,i,0,NULL);
LineTo(hdc,i,300);
i=i+30;
}
for(i=30;i<=300;)
{
MoveToEx(hdc,0,i,NULL);
LineTo(hdc,300,i);
i=i+30;
}
}
EndPaint(hwnd,&ps);
break;
case WM_DESTROY:
DeleteObject(hBl);
DeleteObject(hPl);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return 0;
}


错误如下

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/网格.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

2006-03-23 10:10
howema
Rank: 1
等 级:新手上路
帖 子:336
专家分:0
注 册:2005-10-4
收藏
得分:0 
呵呵 果然是啊  谢谢柳儿 偶是新手 别见笑啊!~
2006-03-23 16:12
快速回复:连接错误
数据加载中...
 
   



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

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