Glitter icon indicating copy to clipboard operation
Glitter copied to clipboard

stbi load not working on macOS, linker problems

Open drs-m opened this issue 3 years ago • 4 comments

trying to use 'stbi_load' does not work in CLion on MacOS. did a fresh clone of master. include_directories contains the stb Vendor folder.

Undefined symbols for architecture x86_64: "_stbi_image_free", referenced from: _main in main.cpp.o "_stbi_load", referenced from: _main in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

drs-m avatar Dec 20 '20 19:12 drs-m

Hmm, I've never tried using CLion. Does it compile if you use a standard makefile?

Polytonic avatar Dec 20 '20 20:12 Polytonic

https://github.com/Polytonic/Glitter/issues/32 this is the way to solve the problem. // Reference: https://github.com/nothings/stb/blob/master/stb_image.h#L4 // To use stb_image, add this in one C++ source file. // #define STB_IMAGE_IMPLEMENTATION #include <stb_image.h>

===== // add these in your "main.cpp" C++ source file #define STB_IMAGE_IMPLEMENTATION #include <stb_image.h>

ACE199704 avatar Jan 24 '21 02:01 ACE199704

did you find a solution?

DevelopmentHF avatar Aug 23 '23 12:08 DevelopmentHF

That was the solution...

PegasusXing avatar Oct 25 '23 21:10 PegasusXing