0
(미리 컴파일 된 헤더 옵션을 사용하지 않고) win32 콘솔 응용 프로그램을 만들었습니다. 그리고 내 소스 코드가 여기에 두 가지 컴파일러 오류가 있습니다.VS2005의 기본 Windows 프로그래밍 질문
// AFormattingMsgBox.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include "stdafx.h"
//int _tmain(int argc, _TCHAR* argv[])
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
int cxScreen, cyScreen;
cxScreen = GetSystemMetrics(SM_CXSCREEN);
cyScreen = GetSystemMetrics(SM_CYSCREEN);
MessageBoxPrintf(TEXT("ScrnSize"), TEXT("The screen is %i pixels wide by %i pixels high."), cxScreen, cyScreen);
return 0;
}
int CDECL MessageBoxPrintf(TCHAR * szCaption, TCHAR * szFormat, int x, int y)
{
TCHAR szBuffer [1024];
va_list pArgList;
va_start(pArgList, szFormat);
_vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR),
szFormat, pArgList);
va_end(pArgList);
return MessageBox(NULL, szBuffer, szCaption, 0);
}
컴파일러 오류.
error C3861: 'MessageBoxPrintf': identifier not found
error C2365: 'MessageBoxPrintf' : redefinition; previous definition was 'formerly unknown identifier
오류를 어떻게 해결할 수 있습니까? 독서와 답장을 보내 주셔서 감사합니다.
당신의 제안을 이어,하지만 여전히 링크 오류를 보여줍니다 : 당신은 다음 줄을 입력하여 프로토 타입을 추가 * 오류 LNK2019을 : 확인되지 않은 외부 기호는 함수에서 참조 _main ___ tmainCRTStartup * –
그리고 나서 변경'INT APIENTRY의 WinMain (. ..)'를'int _tmain (...)'으로 변경합니다. 이제 작동합니다. 감사. –