tags:

views:

140

answers:

3

Hello everyone, this is my first time on stack overflow so please be nice to me =).

Right now, I have a problem with my code, while developing, I have encountered this a million times, and managed to solve it. But right now, I'm writing some serious code, and was wondering.

  1. Why does its happens?
  2. What's the correct way to fix it up

The problem: I declare an int, this time is called *m_Height*, this variable is declared in a header file like this:

protected:
    int m_Width; // Width of the window
    int m_Height; // Height of the window

Then, a function, uses the variables, that are initialized on the constructor, when i compile the code i get an error, telling me that the identifier is not declared,

error C2065: 'm_Heigth' : undeclared identifier

Curious thing is that *m_Height* is reference 3 time in the code, and I only get the message for 2 of them.

if(m_bFullscreen)
{
    SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP);
    SetWindowPos(m_hWnd, HWND_TOP, 0, 0, m_Width, m_Height,
        SWP_NOZORDER | SWP_SHOWWINDOW); // HERE DOES WORKS
}
else
{
    SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
    SetWindowPos(m_hWnd, HWND_TOP, 0, 0, m_Width, m_Heigth,
        SWP_NOZORDER | SWP_SHOWWINDOW); // HERE DOESN'T WORKS
}

// Fill the rest of the params
m_PresentParameters9.BackBufferHeight = m_Heigth; // HERE DOESN'T WORKS

Well, this all I want to ask, so if you have any info on this, please help.

Thanks in advanced.

+7  A: 

Its a simple typo - m_Heigth should be m_Height.

Georg Fritzsche
+1  A: 

You spelled m_Height as m_Heigth. Its a typo.

Brian Neal
wow, i feel like such as noob right now xD but anyway thanks, you save my life,
Fladur
+1  A: 

You have a typo in your code.

You wrote m_Heigth instead of m_Height

gclj5