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条回答

    报告相同问题?

    悬赏问题

    • ¥20 搭建pt1000三线制高精度测温电路
    • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
    • ¥15 画两个图 python或R
    • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
    • ¥15 八路抢答器设计出现故障
    • ¥15 opencv 无法读取视频
    • ¥15 用matlab 实现通信仿真
    • ¥15 按键修改电子时钟,C51单片机
    • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
    • ¥20 5037端口被adb自己占了