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

1

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

'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? Is this causing the issue? How can I load the .dll from the actually downloaded folder?

c++
sdl-2
asked on Stack Overflow Aug 13, 2020 by RevivingSociety • edited Aug 13, 2020 by drescherjm

1 Answer

2

TF2's directory was in the environment variables and that's where it was trying to load from. I removed those directories from the PATH and moved the SDL2.dll file where the exe was being built for my program

answered on Stack Overflow Aug 13, 2020 by RevivingSociety

User contributions licensed under CC BY-SA 3.0