用VC++写了一个win32程序,build时出现error LNK2005(内有代码和具体出错信息))

来源:百度知道 编辑:UC知道 时间:2024/05/11 15:39:32
#define WIN32_LEAN_AND_MEAN

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

// defines for windows
#define WINDOW_CLASS_NAME "WINCLASS1"

LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{

PAINTSTRUCT ps;
HDC hdc;

switch(msg)
{
case WM_CREATE:
{
// do initialization stuff here

// return success
return(0);
} break;

case WM_PAINT:
{
// simply validate the window
hdc = BeginPaint(hwnd,&ps);
// you would do all your painting here
EndPaint(hwnd,&ps);

// return success
return(0);
} break;

case WM_DESTROY:
{

删除掉DEBUG目录下的所有文件,重新编译构建。
window.obj是编译后生成的目标文件,就在DEBUG目录下。
程序本身是没有任何问题的,只要重新构建就可以了。

在我这里是好的!
project rebuild,,
不行新建个win32 application工程,添加c++ source filte,,,,应该是对的!

16行重复定义....hdc换个名字吧