简体   繁体   English

Visual Studio SDL2.dll 代码执行无法继续,因为未找到 SDL2.dll

[英]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."我正在尝试使用 c++ 和 SDL 制作一个 window,但是当我启动我的代码时,它说“代码执行无法继续,因为未找到 SDL2.dll。” And yes, it is confusing because I have SDL2.dll in my source files.是的,这很混乱,因为我的源文件中有 SDL2.dll。 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).您可以手动将其复制粘贴到您的最终构建文件夹,或者将此文件添加到项目并将其构建操作指定为复制到 Output(它曾经为我工作)。

I think there may be option to set up a working directory in a project settings as well.我认为也可以选择在项目设置中设置工作目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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