• Advertisement
Sign in to follow this  

OpenGl OOP & MVC - NeHeGL_OOP HELP!

This topic is 4637 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I am relativvly new at C++, although I understand OOP coming from other languages (Macromedia ActionScript and PHP). I downloaded the program NeHeGL_oop.zip and tried to adapt it to an MVC paradigm. Although I simplified the code because it is using some C++ coding features that I do not yet fully understand, I was able to have a working program... until I made a simple change! Noe the program fail on an Access Violation in the module STRLEN.ASM (according to Visual Studio v6) while creating this class instance: /************************************************** * * Window definition * **************************************************/ WinBase::WinBase (WinClass * winClass) : m_hWnd (NULL), m_pClass (winClass), m_Exstyle (NULL), // extended window style m_pTitle (NULL), // pointer to window name m_style (NULL), // window style m_x (CW_USEDEFAULT), // horizontal position of window m_y (CW_USEDEFAULT), // vertical position of window m_width (CW_USEDEFAULT), // window width m_height (CW_USEDEFAULT), // window height m_hWndParent (HWND_DESKTOP), // handle to parent or owner window m_hMenu (NULL) // handle to menu, or child-window identifier { m_pDebug = new WinDebug ("GL_Windows", MY_DEBUG); m_pDebug->Toggle (); // Activate Debug display return; } I put the whole program on http://rene.dalle.ca/projects/GLapplication.rar ready to be re-compiled with Visual Studio. There is a break defined just at the entry to the class constructor (in GL_Windows.cpp) and if I hit the F10 key, I immediately get the exception ("First-chance exception in GLapplication.exe: 0xC0000005: Access Violation.") with the debugger pointing into the STRLEN.ASM module! If anyone can tell me what I did wrong, I'll be in their debt for ever! Cheers.... RD OK! I found my mistake: m_pTitle (NULL) should have been m_pTitle ("") since I changed the definition from char * to std::string! Now it work fine again! [Edited by - LeLorrain on June 10, 2005 8:50:06 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement