简体   繁体   English

为什么 Visual Studio 试图从 Team Fortress 2 加载 SDL2?

[英]Why is Visual Studio trying to load SDL2 from Team Fortress 2?

I was trying to learn SDL2 and C++ and I was following this tutorial on setting everything up, I copied the code and downloaded the necessary files and moved them, however, when I try to run the code this is what shows in the output我正在尝试学习 SDL2 和 C++ 并且我正在按照本教程进行设置,我复制了代码并下载了必要的文件并移动了它们,但是,当我尝试运行代码时,这就是 output 中显示的内容

'1stSDLWindow.exe' (Win32): Loaded 'C:\Users\Alec\source\repos\1stSDLWindow\x64\Debug\1stSDLWindow.exe'. Symbols loaded.
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'1stSDLWindow.exe' (Win32): Loaded 'C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\bin\SDL2.dll'. 
'1stSDLWindow.exe' (Win32): Unloaded 'C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\bin\SDL2.dll'
The thread 0x7e8 has exited with code -1073741701 (0xc000007b).
The thread 0x32c8 has exited with code -1073741701 (0xc000007b).
The program '[6436] 1stSDLWindow.exe' has exited with code -1073741701 (0xc000007b).

There is no screen that displays green as the code should and an error pops up with this没有像代码那样显示绿色的屏幕,并且弹出一个错误

This is the 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;
}

Why is it trying to load SDL2.dll from my TF2 directory?为什么它试图从我的 TF2 目录加载 SDL2.dll? Is this causing the issue?这是造成问题的原因吗? How can I load the.dll from the actually downloaded folder?如何从实际下载的文件夹中加载.dll?

TF2's directory was in the environment variables and that's where it was trying to load from. TF2 的目录位于环境变量中,这就是它试图从中加载的位置。 I removed those directories from the PATH and moved the SDL2.dll file where the exe was being built for my program我从PATH中删除了这些目录,并移动了 SDL2.dll 文件,该文件正在为我的程序构建 exe

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

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