注册 登录
编程论坛 VC++/MFC

VS2010 Win32应用程序写MFC,编译出错

nandiin 发布于 2013-03-01 11:16, 1464 次点击
我是现在VC++6.0里写的,一个很简单的程序 就是一开始全屏白,再全屏黑,再绘制三个白色的圆。
是用来图像识别时的边缘检测和矩阵转换的(这个跟本程序本身没关系····)

还有一些功能需要用到openCV,又不像下一个老版本的openCV去配合VC++6.0就把程序挪到VS2010里去执行,可是编译报错很恶心,头文件都编不过去···谁能帮忙解答一下吗。
下面
1#头文件
2#源文件
3#报错 内容
4 回复
#2
nandiin2013-03-01 11:16
程序代码:
#ifndef _FULLSCREEN
#define _FULLSCREEN
#include <AFXWIN.H>
class CFullScrnApp:public CWinApp
{
private:
protected:
public:
    virtual BOOL InitInstance();
};
class CFullScrnWindow:public CFrameWnd
{
public:
    CFullScrnWindow();
    afx_msg void OnNcPaint();
    afx_msg void OnTimer(UINT);
    DECLARE_MESSAGE_MAP()
};
#endif
#3
nandiin2013-03-01 11:17
程序代码:
//*****************
// Full Screen Test
//*****************
#include "FullScreenApp.h"
#define GAP 1000
#define ID_TIMER1 1
#define ID_TIMER2 2
CFullScrnApp FullScrnApp;
int nFullWidth=GetSystemMetrics(SM_CXSCREEN);  
int nFullHeight=GetSystemMetrics(SM_CYSCREEN);

BEGIN_MESSAGE_MAP(CFullScrnWindow,CFrameWnd)
ON_WM_NCPAINT()
ON_WM_TIMER()
END_MESSAGE_MAP()

BOOL CFullScrnApp::InitInstance()
{
    m_pMainWnd=new CFullScrnWindow();
    m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
    m_pMainWnd->UpdateWindow();
    return TRUE;
}
CFullScrnWindow::CFullScrnWindow()
{
    Create(NULL,"FullScreenTest",WS_OVERLAPPEDWINDOW,CRect(0,0,nFullWidth,nFullHeight));
    SetWindowLong(this->m_hWnd,GWL_STYLE,255);
    SetTimer(ID_TIMER1,GAP,NULL);
    SetTimer(ID_TIMER2,GAP*2,NULL);
}
void CFullScrnWindow::OnNcPaint()   
{  
    CWindowDC dc(this);
    dc.FillSolidRect(0,0,nFullWidth,nFullHeight,RGB(255,255,255));
}
void CFullScrnWindow::OnTimer(UINT nIDEvent)
{
    CWindowDC dc(this);
    if (nIDEvent==1)
    {
        dc.FillSolidRect(0,0,nFullWidth,nFullHeight,RGB(0,0,0));
        KillTimer(ID_TIMER1);
    }
    else if(nIDEvent==2)
    {        
        CBrush cBrush;
        CWindowDC dc(this);
        cBrush.CreateSolidBrush(RGB(255,255,255));
        dc.Ellipse(10,0,80,70);
        dc.Ellipse(1277,10,1347,80);
        dc.Ellipse(752,615,822,685);
        KillTimer(ID_TIMER2);
    }
}
#4
nandiin2013-03-01 11:18
1>------ Build started: Project: FullScreen, Configuration: Debug Win32 ------
1>  FullScreen.cpp
1>  _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(137): error C2011: 'CSize' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(26) : see declaration of 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(176): error C2011: 'CPoint' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(69) : see declaration of 'CPoint'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(225): error C2011: 'CRect' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(125) : see declaration of 'CRect'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3195): error C2079: 'CFrameWnd::m_rectBorder' uses undefined class 'CRect'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3741): error C2079: 'CScrollView::m_totalLog' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3742): error C2079: 'CScrollView::m_totalDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3743): error C2079: 'CScrollView::m_pageDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3744): error C2079: 'CScrollView::m_lineDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3870): error C2079: 'CWinThread::m_ptCursorLast' uses undefined class 'CPoint'
1>e:\vs2010 workspace\fullscreen\fullscreen\fullscreen.h(4): fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#5
nandiin2013-03-06 16:26
卸载重装vs2010解决
1