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

compilation error "fatal error: stb_image.h: No such file or directory" #227

Open
martian17 opened this issue Jul 1, 2022 · 4 comments
Open

Comments

@martian17
Copy link

martian17 commented Jul 1, 2022

Being an absolute beginner in image processing in C, I ran the most intuitive command that I could come up with: make
However, that was met with the following error

$ make
cc -std=gnu99 -O3 qoibench.c -o qoibench -lpng
qoibench.c:41:10: fatal error: stb_image.h: No such file or directory
   41 | #include "stb_image.h"
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:14: qoibench] Error 1

Does this mean that I need to copy over stb_image.h from somewhere else? or do I need to rewrite the source to point the header include to somewhere else?
I hope I'm not alone on this.
Also, I think there should be an instruction on how to compile on the main README page for beginners like me.

@martian17
Copy link
Author

Some information about my system
OS: xUbuntu 20.04
cc -v output

$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

@amstan
Copy link
Contributor

amstan commented Jul 1, 2022

See https://github.com/phoboslab/qoi/blob/master/qoiconv.c#L5. Essentially you just need to have those downloaded h files in the same folder. Alternatively you can add an extra CC flag with the -I arg to tell it where it is on your system (if you use a package manager to install that lib).

@martian17
Copy link
Author

I ended up cloning https://github.com/nothings/stb.git into a different directory, and re-writing each c files to point to that directory.
That worked, but I'll try editing the Makefile to add the -l arg from next time.
Thank you for the advice!

@vtorri
Copy link
Contributor

vtorri commented Aug 14, 2023

please close issue

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

3 participants