这是我的代码:
#include "stdafx.h"
#include <Windows.h>
extern "C" int __stdcall myfunction ();
BOOL WINAPI DllMain ( HINSTANCE hin, DWORD reason, LPVOID lpvReserved );
int __stdcall myfunction ()
{
MessageBoxW(NULL,L"Question",L"Title",MB_OK);
return 0;
}
BOOL WINAPI DllMain ( HINSTANCE hin, DWORD reason, LPVOID lpvReserved )
{
return TRUE;
}
当我编译显示这些错误:
错误 LNK2028: 对 simbol (token) 的引用未解析 (0A000027) "extern "C" int stdcall MessageBoxW(struct HWND *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@ Z) 在函数 "extern "C" int __stdcall myfunction(void)" (?myfunction@@$$J10YGHXZ)
错误 LNK2019:外部符号“extern "C" int stdcall MessageBoxW(struct HWND *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@Z) 未在函数中使用“ extern "C" int __stdcall myfunction(void)" (?myfunction@@$$J10YGHXZ)
我不明白错误在哪里及其原因。如果有人可以帮我解决它,我会非常感谢:)