C语言帮忙排错
#include "stdafx.h"#include <windows.h>
#include <windowsx.h>
#include "resource.h"
#include "MainDlg.h"
BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog);
HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand);
HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose);
}
return FALSE;
}
BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
HWND hwndCOMBO1=GetDlgItem(hwnd,IDC_COMBO1);
ComboBox_AddString(hwndCOMBO1,TEXT("北京市"));
ComboBox_AddString(hwndCOMBO1,TEXT("天津市"));
ComboBox_AddString(hwndCOMBO1,TEXT("上海市"));
return TRUE;
}
void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
switch(id)
{
case IDC_OK:
{
HWND hwndCOMBO1=GetDlgItem(hwnd,IDC_COMBO1);
int cursel=ComboBox_GetCurSel(hwndCOMBO1);
if(0==cursel)
{
MessageBox(hwnd,TEXT("我爱北京"),TEXT("消息"),MB_OK);
}
if(1==cursel)
{
MessageBox(hwnd,TEXT("我爱上海"),TEXT("消息"),MB_OK);
}
if(2==cursel)
{
MessageBox(hwnd,TEXT("我爱天津"),TEXT("消息"),MB_OK);
}
}
break;
default:
break;
}
}
void Main_OnClose(HWND hwnd)
{
EndDialog(hwnd, 0);
}
各位大神看看这条代码,为什么组建老有错误。提示的错误为:Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/MainDlg.exe : fatal error LNK1120: 1 unresolved externals