Register
raylib»Forums»stb included giving to me errors
1 posts
stb included giving to me errors
1 week, 4 days ago Edited by sizdedei on Nov. 5, 2019, 2:37 p.m. Reason: Initial post
newbie here
raylib uses stb, im trying to use some stb references/functions but it give to me errors (im trying to load some images directly by stb cause im needing for some reasons), when i try to use stb headers together it say to me that reference/function is duplicated
which header can i include to use raylib directly from source instead create a library and include header?
Simon Anciaux
681 posts
stb included giving to me errors
1 week, 3 days ago
When asking such questions, try to give the exact error message and which platform you are working on. If possible post a reproduction case with smallest amount of code that can reproduce the problem.

If raylib contains the stb functions you need (in the dll or the lib), you need to include the stb_image.h header and NOT define STB_IMAGE_IMPLEMENTATION. Also it's better if you use the stb_image.h from raylib github to make sure you use the same version.

1
2
3
4
5
6
7
#include "raylib.h"
#include "stb_image.h"

int main( void ) {
    int x,y,n;
    unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
}


That is assuming that you're linking against raylib.lib or raylib_static.lib.

Raylib wiki on github.