Function 类函数在main中不工作-SDL

Function 类函数在main中不工作-SDL,function,class,sdl,main,simulator,Function,Class,Sdl,Main,Simulator,我想做一个弹跳球模拟器。我有单独的球课,但是我有一个问题。例如,如果我在main中调用Ball类函数myBall.show,则球不会显示。但是,如果在main中,我完整地写出了函数,而不仅仅是myBall.show,它就可以工作了。无论如何,要解决这个问题,其他函数也会出现这种情况 Main.cpp // Ball Simulator.cpp : Defines the entry point for the console application. // #include "stdafx.h"

我想做一个弹跳球模拟器。我有单独的球课,但是我有一个问题。例如,如果我在main中调用Ball类函数myBall.show,则球不会显示。但是,如果在main中,我完整地写出了函数,而不仅仅是myBall.show,它就可以工作了。无论如何,要解决这个问题,其他函数也会出现这种情况

Main.cpp

// Ball Simulator.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"

#include "Globals(BallSim).h"
#include "Ball.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{


Ball myBall;//ball that will be used for the program

while (quit == false)//game loop, while user hasnt quit
{
    while (SDL_PollEvent(&event)) //while there is an event to handle
    {
        if (event.type == SDL_QUIT)
        {
            quit = true;
            break;
        }

    }

    //show the ball
    myBall.show();//THIS DOESNT WORK, EVEN THOUGH LINE BELOW IS SAME
    //SDL_BlitSurface(BallSurface, NULL, ScreenSurface, &posBall);//THIS WORKS

    //move the ball
    myBall.move();//THIS DOESNT WORK
            SDL_BlitSurface(Ball, NULL, ScreenSurface, &posBall); //THIS WORKS


    //update the window
    SDL_UpdateWindowSurface(Window);

}


return 0;
}

这是太多的代码。把它缩小到一个小例子。我现在做了很多工作。显然,问题不在于SDL库,而在于编程逻辑。尝试编写一个没有任何库的小测试示例来确定问题。然后您可以将示例作为新问题发布。您是否为Ball.h使用单独的实现文件,如果是,编译器是否包含该文件?请发布SSCCE,以便我们能提供更多帮助。