c++ - SDL配置问题,提示出现0XC000007b?
PHP中文网
PHP中文网 2017-04-17 11:56:11
0
1
659

我按照lazy Foo的课程学习SDL开发,然后今天配置这个环境。程序能通过编译,不过运行时出现“应用程序无法正常启动(0xc000007b),请单击确定关闭应用程序),我在网上找了一下,不过给出的解决方案都不行。
问题应该是,程序是32位编译的,不过运行时的SDL2.dll是64位版本的。不过怎么解决呢?我是按照32位配置的,不过我把32位版本的SDL2.dll放在windows/System32文件夹下面时根本就没用。
用64位的SDL2.dll虽然能通过,不过却出现无法正确运行。
这是原教程的网址:http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvsnet2010u/ind...
作者给的示例代码:

/*This source code copyrighted by Lazy Foo' Productions (2004-2015)
and may not be redistributed without written permission.*/

//Using SDL and standard IO
#include <SDL.h>
#include <stdio.h>

//Screen dimension constants
const int SCREEN_WIDTH = 1366;
const int SCREEN_HEIGHT = 768;

int main(int argc, char* args[])
{
    //The window we'll be rendering to
    SDL_Window* window = NULL;

    //The surface contained by the window
    SDL_Surface* screenSurface = NULL;

    //Initialize SDL
    if (SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
    }
    else
    {
        //Create window
        window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
        if (window == NULL)
        {
            printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
        }
        else
        {
            //Get window surface
            screenSurface = SDL_GetWindowSurface(window);

            //Fill the surface white
            SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));

            //Update the surface
            SDL_UpdateWindowSurface(window);

            //Wait two seconds
            SDL_Delay(2000);
        }
    }

    //Destroy window
    SDL_DestroyWindow(window);

    //Quit SDL subsystems
    SDL_Quit();

    return 0;

PHP中文网
PHP中文网

认证0级讲师

membalas semua(1)
PHPzhong

32bit 的开发,你就必须全套都用32bit的。 library和dll都是。
另外不建议把sdl2.dll放system32文件夹下面,可能会造成污染。直接放项目里就行了。

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan