I'm trying to make a program with SDL2.0 but the program doesn't show any output and it quit instantly.
I am using Windows 10 x64 and I am doing this on VSCode, latest CMake version.
I actually tried amd64
, amd64_x86
, x86
, x86_amd64
toolchains, same thing happens.
A normal hello world program worked well but when importing SDL.h it wouldn't do anything, no output and delays.
C++ Program (main.py):
#include "SDL.h"
#include <stdio.h>
int main( int argc, char* args[] )
{
printf("Hi\n");
SDL_Init(SDL_INIT_VIDEO);
SDL_Delay(5 * 1000);
SDL_Quit();
return 0;
}
When debugging the log stated that "MuserSDL.exe' has exited with code -1073741515 (0xc0000135)". CMake file:
cmake_minimum_required(VERSION 3.0.0)
project(MuserSDL VERSION 0.1.0)
include(CTest)
enable_testing()
include_directories(sdl/include)
link_directories(sdl/lib/x64)
message(${PROJECT_SOURCE_DIR})
add_executable(MuserSDL src/main.cpp)
target_link_libraries(MuserSDL SDL2 SDL2main)
target_include_directories(MuserSDL PUBLIC sdl/include)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
The tree printed by tree /a /f
(Reduced)
C:.
| .gitignore
| CMakeLists.txt
| LICENSE
| README.md
|
+---.vscode
| settings.json
|
+---build (...)
|
+---sdl
| | BUGS.txt
| | ...
| |
| +---docs (...)
| |
| +---include
| | begin_code.h
| | close_code.h
| | SDL.h
| | ...
| |
| \---lib
| +---x64
| | SDL2.dll
| | SDL2.lib
| | SDL2main.lib
| | SDL2test.lib
| |
| \---x86 (...)
|
\---src
main.cpp