Hello2 error LNK2019: 无法解析的外部符号 _main ,该符号在函数 _mainCRTStartup 中被引用
源程序如下:
//Hello2.cpp
#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <assert.h>
void CenterText(HDC hDC, int x, int y, LPCTSTR szFace, LPCTSTR szMessage, int point)
{
HFONT hFont = CreateFont(
-point * GetDeviceCaps(hDC, LOGPIXELSY) / 72,
0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE,
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, VARIABLE_PITCH, szFace);
assert(hFont);
HGDIOBJ hOld = SelectObject(hDC, hFont);
SetTextAlign(hDC, TA_CENTER | TA_BASELINE);
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, RGB(0, 0, 0xFF));
TextOut(hDC, x, y, szMessage,lstrlen(szMessage));
SelectObject(hDC,hOld);
DeleteObject(hFont);
}
const TCHAR szMessage[] = _T("Hello, world!");
const TCHAR szFace[] = _T("Times New Roman");
#pragma comment(linker, "-merge:.rdata=.txt")
#pragma comment(linker, "-align:512")
extern "C" void WinMainCRTStartup()
{
HDC hDC = GetDC(NULL);
assert(hDC);
CenterText(hDC, GetSystemMetrics(SM_CXSCREEN) / 2,
GetSystemMetrics(SM_CYSCREEN) / 2, szFace, szMessage, 72);
ReleaseDC(NULL,hDC);
ExitProcess(0);
}
程序是GDI编程的附书源码,原工程能正确链接,为什么完整拷贝过来之后,却不能链接了?