[英]getting Strange error in WINAPI 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)
這是我的源代碼
#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
錯誤告訴您該功能
LRESULT CALLBACK windowProcess(HWND,UINT,WPARAM,LPARAM);
僅在任何地方聲明和定義。
檢查項目道具->鏈接器->系統->子系統。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.