visual c++ - C++ Access violation when using SDL_ttf with SDL and SDL2 -


i using sdl2_ttf sdl2 (in visual studio 2015). when tried run following code,

#include "sdl.h" #include "sdl_ttf.h"  int main(int argc, char* args[]) {     sdl_init(sdl_init_everything);     ttf_init();      sdl_window* window;     sdl_renderer* renderer;     sdl_createwindowandrenderer(1600, 900, sdl_window_opengl, &window, &renderer);      ttf_font* font = ttf_openfont("comic.ttf", 12);     sdl_color color = { 0, 0, 0, 255 };     sdl_surface* textsurface = ttf_rendertext_solid(font, "asdf", color);     sdl_texture* texture = sdl_createtexturefromsurface(renderer, textsurface);      ttf_quit();     sdl_quit();     return 0; } 

i got "sdl.dll missing" runtime error. put sdl.dll, alongside sdl2.dll, libfreetype-6.dll, sdl_ttf.dll, zlib1.dll , other libraries in system32 folder, solved runtime error, instantaneously ran error: "unhandled exception @ 0x000000006c812e39 (sdl2.dll) in mcp2016.exe: 0xc0000005: access violation reading location 0x000000010000006a."

when decided "break" in visual studio dialog telling me this, pointed line

sdl_texture* texture = sdl_createtexturefromsurface(renderer, textsurface);

i came across old forum post suggested sdl_ttf , sdl2 can cause access violations because not compatible. think has problems have, since complained sdl.dll first. suggested recompile dll sdl2 header files, afraid beyond competence, because windows , c++ not along well.

i have been working on 8 hours , running out of ideas try solve this. have ideas this?

sdl , sdl2 not compatible. either have one, or other.

as mentioned in comments, fix use sdl2_ttf instead.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -