简体   繁体   English

链接期间在WINAPI中得到奇怪的错误

[英]getting Strange error in WINAPI during linking

this is the error I am getting during linking: 这是我在链接过程中遇到的错误:

main.obj : error LNK2001: unresolved external symbol "long __stdcall windowProcess(struct HWND__ *,unsigned int,unsigned int,long)" (?windowProcess@@YGJPAUHWND__@@IIJ@Z)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/main.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

main.exe - 3 error(s), 0 warning(s)

here is my source code 这是我的源代码

#include <windows.h>
//#include <stdlib.h>
//#include <string.h>
#include "stdafx.h"

//1. Declaring windowProcess of type LRESULT
//2. WIN API
//3. WIndow Class
//4. Register Class
//5. Create Window
//6. Show Window

// The main window class name
const char myClassName[] = "myClass";



//1. Moving towards 1st step & showing the ass of Window Process
LRESULT CALLBACK windowProcess(HWND,UINT,WPARAM,LPARAM);

//2. Using win api
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevIntance,
                   LPSTR lpcmdLine,
                   int comandNumber){

WNDCLASS wc;
wc.style=CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc=windowProcess;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_APPLICATION));
wc.hbrBackground=NULL;
wc.lpszMenuName=NULL;
wc.lpszClassName=myClassName;

//3. Registering Wnd Class
if(!RegisterClass(&wc))
    {
        MessageBox(NULL,"Class didnot get registered","An Simple Window Application",NULL);
    }
//hint=hInstance;

//4. registering window class
HWND hWnd=CreateWindow(myClassName,"Title f Window",WS_OVERLAPPEDWINDOW,0,0,500,100,NULL,NULL,hInstance,NULL);

if(!hWnd)
    {
        MessageBox(NULL,"window didnt created","An Simple Windw Application",NULL);
    }
//5. Now after window has been created lets show this window
ShowWindow(hWnd,comandNumber);
UpdateWindow(hWnd);
return 1;
}//winapi WinMain function ends

The error tells you that the function 错误告诉您该功能

LRESULT CALLBACK windowProcess(HWND,UINT,WPARAM,LPARAM);

is only declared and defined nowhere. 仅在任何地方声明和定义。

检查项目道具->链接器->系统->子系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM