Chả là e làm = VC6 , xây dựng MFC nó tự sinh ra code ở mấy hàm bị lỗi ấy, trước đây chạy vẫn ngon lành cành đào mà sao hôm nay e xây dựng thêm code cho Project mà nó lại lỗi thế đấy, 100% là e k có sửa code của mấy hàm nó tự đẻ code đâu, vậy lí do là do đâu,

Các bác có thể giúp e sửa lỗi này không?


Nó ra lỗi thế này các bác ạ.

--------------------Configuration: GAS - Win32 Debug--------------------
Compiling...
GASView.cpp
E:\Documents\BIN\GAS\GASView.cpp(71) : error C2440: 'initializing' : cannot convert from 'class CDocument *' to 'class CGASDoc *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\Documents\BIN\GAS\GASView.cpp(91) : error C2509: 'GetDocument' : member function not declared in 'CGASView'
e:\documents\bin\gas\gasview.h(14) : see declaration of 'CGASView'
Error executing cl.exe.

GASView.obj - 2 error(s), 0 warning(s)
__________________________________________________ ______________________________

Visual C# Code:
  1. // GASView.cpp : implementation of the CGASView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "GAS.h"
  6.  
  7. #include "GASDoc.h"
  8. #include "GASView.h"
  9. #include "math.h"
  10. #include "VeDiemDiaglog.h"
  11. #include "HVariable.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CGASView
  22.  
  23. IMPLEMENT_DYNCREATE(CGASView, CView)
  24.  
  25. BEGIN_MESSAGE_MAP(CGASView, CView)
  26.     //{{AFX_MSG_MAP(CGASView)
  27.     ON_WM_CREATE()
  28.     ON_WM_DESTROY()
  29.     ON_WM_SIZE()
  30.     ON_WM_PAINT()
  31.     ON_COMMAND(ID_TESTCHOITHOI_IDRFIRST, VeHamBac3)
  32.     ON_COMMAND(IDD_VEDIEM, CVeDiemDiaglog::OnVediem)
  33.     //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35.  
  36.  
  37.  
  38.  
  39. extern float tempkx;
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CGASView construction/destruction
  43.  
  44. CGASView::CGASView()
  45. {
  46.     // TODO: add construction code here
  47.     m_hGLContext = NULL;
  48.     m_GLPixelIndex = 0;
  49.     //alpha=45;
  50.  
  51. }
  52.  
  53. CGASView::~CGASView()
  54. {
  55. }
  56.  
  57. BOOL CGASView::PreCreateWindow(CREATESTRUCT& cs)
  58. {
  59.     // TODO: Modify the Window class or styles here by modifying
  60.     //  the CREATESTRUCT cs
  61.     // Chon them kieu cho cua so
  62.     cs.style |= (WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
  63.     return CView::PreCreateWindow(cs);
  64. }
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CGASView drawing
  68.  
  69. void CGASView::OnDraw(CDC* pDC)
  70. {
  71.     CGASDoc* pDoc = GetDocument();
  72.     ASSERT_VALID(pDoc);
  73.     // TODO: add draw code for native data here
  74. }
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CGASView diagnostics
  77.  
  78. #ifdef _DEBUG
  79. void CGASView::AssertValid() const
  80. {
  81.     CView::AssertValid();
  82. }
  83.  
  84. void CGASView::Dump(CDumpContext& dc) const
  85. {
  86.     CView::Dump(dc);
  87. }
  88.  
  89.  
  90. CGASDoc* CGASView::GetDocument() // non-debug version is inline
  91. {
  92.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGASDoc)));
  93.     return (CGASDoc*)m_pDocument;
  94. }
  95.  
  96. #endif //_DEBUG
  97.  
  98.  
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CGASView message handlers
  101.  
  102.  
  103. int CGASView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  104. {
  105.     if (CView::OnCreate(lpCreateStruct) == -1)
  106.         return -1;
  107.    
  108.     // TODO: Add your specialized creation code here
  109.     HWND hWnd = GetSafeHwnd();
  110.     HDC hDC = ::GetDC(hWnd);
  111.     if( SetWindowPixelFormat(hDC)== FALSE ) return 0;
  112.     if( CreateViewGLContext(hDC) == FALSE ) return 0;
  113.  
  114.     return 0;
  115. }
  116.  
  117. //----------------------------------------------------------------------//
  118.  
  119. //------------------------------------------------------------------------//
  120.  
  121. BOOL CGASView::CreateViewGLContext(HDC hDC)
  122. {
  123.     m_hGLContext= wglCreateContext(hDC);
  124.     if(m_hGLContext == NULL)    return FALSE;
  125.     if (wglMakeCurrent(hDC,m_hGLContext)== FALSE)   return FALSE;
  126.     return TRUE;
  127.  
  128. }
  129.  
  130. BOOL CGASView::SetWindowPixelFormat(HDC hDC)
  131. {
  132.     PIXELFORMATDESCRIPTOR pixelDesc;
  133.     pixelDesc.nSize = sizeof(PIXELFORMATDESCRIPTOR);
  134.     pixelDesc.nVersion = 1;
  135.     pixelDesc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
  136.              PFD_DOUBLEBUFFER;
  137.     pixelDesc.iPixelType = PFD_TYPE_RGBA;
  138.     pixelDesc.cColorBits = 32;
  139.     pixelDesc.cRedBits = 0;
  140.     pixelDesc.cRedShift = 0;
  141.     pixelDesc.cGreenBits = 0;
  142.     pixelDesc.cGreenShift = 0;
  143.     pixelDesc.cBlueBits=0;
  144.     pixelDesc.cBlueShift=0;
  145.     pixelDesc.cAlphaBits=0;
  146.     pixelDesc.cAlphaShift=0;
  147.     pixelDesc.cAccumBits=0;
  148.     pixelDesc.cAccumRedBits=0;
  149.     pixelDesc.cAccumGreenBits=0;
  150.     pixelDesc.cAccumBlueBits=0;
  151.     pixelDesc.cAccumAlphaBits=0;
  152.     pixelDesc.cDepthBits=32;
  153.     pixelDesc.cStencilBits=0;
  154.     pixelDesc.cAuxBuffers=0;
  155.     pixelDesc.iLayerType= PFD_MAIN_PLANE;
  156.     pixelDesc.bReserved=0;
  157.     pixelDesc.dwLayerMask=0;
  158.     pixelDesc.dwVisibleMask=0;
  159.     pixelDesc.dwDamageMask=0;
  160.     m_GLPixelIndex = ChoosePixelFormat( hDC,&pixelDesc);
  161.     if (m_GLPixelIndex==0){
  162.         m_GLPixelIndex = 1;
  163.         if(DescribePixelFormat(hDC,m_GLPixelIndex,
  164.             sizeof(PIXELFORMATDESCRIPTOR),&pixelDesc)==0){
  165.             return FALSE;
  166.         }
  167.     }
  168.     if (SetPixelFormat( hDC,m_GLPixelIndex,&pixelDesc)==FALSE){
  169.         return FALSE;
  170.     }
  171.     return TRUE;
  172. //  glCullFace(GL_BACK);
  173. }
  174.  
  175. BOOL CGASView::Create(LPCTSTR lpszClassName,
  176.                       LPCTSTR lpszWindowName,
  177.                       DWORD dwStyle,
  178.                       const RECT& rect,
  179.                       CWnd* pParentWnd,
  180.                       UINT nID,
  181.                       CCreateContext* pContext) {
  182.     // TODO: Add your specialized code here and/or call the base class 
  183.     return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
  184. }
  185.  
  186.  
  187. //------------------------------------------------------------------------
  188. //------------------------------------------------------------------------
  189. //------------------------------------------------------------------------
  190. //------------------------------------------------------------------------
  191. //------------------------------------------------------------------------
  192.  
  193. void CGASView::OnDestroy()
  194. {
  195.     if( wglGetCurrentContext()!=NULL)   wglMakeCurrent(NULL,NULL);
  196.     if( m_hGLContext!=NULL){
  197.         wglDeleteContext(m_hGLContext);
  198.         m_hGLContext=NULL;
  199.     }
  200.  
  201.     CView::OnDestroy();
  202.    
  203.     // TODO: Add your message handler code here
  204.    
  205. }