Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stbi load not working on macOS, linker problems #70

Open
drs-m opened this issue Dec 20, 2020 · 4 comments
Open

stbi load not working on macOS, linker problems #70

drs-m opened this issue Dec 20, 2020 · 4 comments

Comments

@drs-m
Copy link

drs-m commented Dec 20, 2020

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)

@Polytonic
Copy link
Owner

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

@ACE199704
Copy link

ACE199704 commented Jan 24, 2021

#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>

@DevelopmentHF
Copy link

did you find a solution?

@PegasusXing
Copy link

That was the solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants