C++求助!!!谢谢~

来源:百度知道 编辑:UC知道 时间:2024/05/30 11:21:43
这是孙鑫视频教程中的代码,我用我的VC6.0编译器,完全复制,有的时候能够编译成功,过几天就不能了,现在就不能用了。

出现这样的错误,Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WinMain.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

WinMain.exe - 2 error(s), 0 warning(s)

请高手指教,到底是哪里错了??一下是源代码:

#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;

你这个不是标准的C语言编程,你看入口函数并不是main,你是windows sdk编程,因此你需要先创建一个win32的工程:
1.选择File->New
2.然后选择Projects中的win32 Application
3.在右上的project name中输入名字后点ok
4.然后选择Finish
5.在这个工程中创建一个空的cpp文件,然后把你的代码拷入,编译