【发布时间】:2012-07-09 12:47:38
【问题描述】:
这是我的代码:
#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 (令牌)未解析(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)
我不明白错误在哪里及其原因。 如果有人可以帮我解决它,我会非常感谢:)
【问题讨论】:
标签: c++ dll compiler-errors