sharexueluffy 2013-10-10 02:30 采纳率: 0%
浏览 1469

1>Generic.obj : error LNK2019: 无法解析的外部符号

//Generic.cpp
#include // 每一个 Windows 程序都需要包含此档
#include "resource.h" // 內含各个 resource IDs
#include "Generic.h" // 本程序之含入档

HINSTANCE _hInst; // Instance handle
HWND _hWnd;

char _szAppName[] = "Generic"; //
char _szTitle[] = "Generic Sample Application"; //

// WinMain -
//---------------------------------------------------------------
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

if (!hPrevInstance)
if (!InitApplication(hInstance))
return (FALSE);

if (!InitInstance(hInstance, nCmdShow))
return (FALSE);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return (msg.wParam); //
}
//---------------------------------------------------------------
// InitApplication -
//---------------------------------------------------------------
BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc; //
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;

wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground =(HBRUSH) GetStockObject(WHITE_BRUSH); //
wc.lpszMenuName = (LPCWSTR)"GenericMenu"; // .RC
wc.lpszClassName =(LPCWSTR) _szAppName;

return (RegisterClass(&wc));
}
//---------------------------------------------------------------
// InitInstance -
//---------------------------------------------------------------
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
_hInst = hInstance; //

_hWnd = CreateWindow(
(LPCWSTR)_szAppName,
(LPCWSTR)_szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL
);

if (!_hWnd)
return (FALSE);

ShowWindow(_hWnd, nCmdShow); //
UpdateWindow(_hWnd); // 送出 WM_PAINT
return (TRUE);
}

//Generic.h
#include

BOOL InitApplication(HANDLE);
BOOL InitInstance(HANDLE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

生成时发生这样的错误:
1>Generic.obj : error LNK2019: 无法解析的外部符号 "int __cdecl InitInstance(void *,int)" (?InitInstance@@YAHPAXH@Z),该符号在函数 _WinMain@16 中被引用
1>Generic.obj : error LNK2019: 无法解析的外部符号 "int __cdecl InitApplication(void *)" (?InitApplication@@YAHPAX@Z),该符号在函数 _WinMain@16 中被引用
1>C:\Users\Share\Documents\Visual Studio 2010\Projects\firstwindow\Debug\firstwindow.exe : fatal error LNK1120: 2 个无法解析的外部命令

急急急~ 求大神指教。

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)