简体   繁体   中英

Visual Studio SDL2.dll The code execution cannot proceed because SDL2.dll was not found

I am trying to make a window with c++ and SDL, But when I launch my code, it says "The code execution cannot proceed because SDL2.dll was not found." And yes, it is confusing because I have SDL2.dll in my source files. Do anyone know how to fix it.?

Code:

#include "SDL.h"

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

    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_Window* window = SDL_CreateWindow("title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 400, SDL_WINDOW_SHOWN);
    SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0);

    SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);

        SDL_RenderClear(renderer);

        SDL_RenderPresent(renderer);

        SDL_Delay(3000);



    return 0;
}

You may either manually copypaste it to your final build folder, or add this file to a project and specify its build action as Copy to Output (it used to work for me).

I think there may be option to set up a working directory in a project settings as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM