sdl 2 with visual studio 2013(简单的例子不起作用,一直崩溃)

sdl 2 with visual studio 2013 ( simple example doesn't work keep crashing)

我用 Visual Studio 2010 编译 SDL2 没有任何问题。我已决定将 visual studio 升级到 2013。我的简单示例没有 运行 并继续向我显示此消息

这就是我所做的

我的项目文件夹看起来像

main.cpp 
SDL2.dll ( from F:xxx\SDL2-2.0.3\lib\x86

CMD 是

 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC> cl /?
    Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
    Copyright (C) Microsoft Corporation.  All rights reserved.

从命令编译

cl /EHsc /MD  main.cpp /Fetest.exe /I F:\C++_Libraries\SDL2\SDL2-2.0.3\include /link /LIBPATH:F:\C++_Libraries\SDL2\SDL2-2.0.3\lib\x86 SDL2.lib SDL2main.lib /SUBSYSTEM:CONSOLE

main.cpp

#include <cstdio>
#include "SDL.h"

int main(int argc, char* argv[]) {

    SDL_Window *window;                    // Declare a pointer

    SDL_Init(SDL_INIT_VIDEO);              // Initialize SDL2

    // Create an application window with the following settings:
    window = SDL_CreateWindow(
        "An SDL2 window",                  // window title
        SDL_WINDOWPOS_UNDEFINED,           // initial x position
        SDL_WINDOWPOS_UNDEFINED,           // initial y position
        640,                               // width, in pixels
        480,                               // height, in pixels
        SDL_WINDOW_OPENGL                  // flags - see below
    );

    // Check that the window was successfully made
    if (window == NULL) {
        // In the event that the window could not be made...
        printf("Could not create window: %s\n", SDL_GetError());
        return 1;
    }

    // The window is open: enter program loop (see SDL_PollEvent)

    SDL_Delay(3000);  // Pause execution for 3000 milliseconds, for example

    // Close and destroy the window
    SDL_DestroyWindow(window);

    // Clean up
    SDL_Quit();
    return 0;
}

这可能是因为您可能没有使用 2013 工具集重新编译您的 dll。