Home > OS >  Fedora: 'GLFW/glfw3.h: No such file or directory'
Fedora: 'GLFW/glfw3.h: No such file or directory'

Time:10-11

I am very new to C when trying to make some example code I get the error

basic.cc:18:10: fatal error: GLFW/glfw3.h: No such file or directory

On further inspection the contents of the Makefile are

# This Makefile assumes that you have GLFW libraries and headers installed on,
# which is commonly available through your distro's package manager.
# On Debian and Ubuntu, GLFW can be installed via `apt install libglfw3-dev`.

COMMON=-O2 -I../include -L../lib -std=c  17 -pthread -Wl,-no-as-needed -Wl,-rpath,'$$ORIGIN'/../lib

all:
    $(CXX) $(COMMON) testxml.cc            -lmujoco          -o ../bin/testxml
    $(CXX) $(COMMON) testspeed.cc          -lmujoco          -o ../bin/testspeed
    $(CXX) $(COMMON) compile.cc            -lmujoco          -o ../bin/compile
    $(CXX) $(COMMON) derivative.cc         -lmujoco -fopenmp -o ../bin/derivative
    $(CXX) $(COMMON) basic.cc              -lmujoco -lglfw   -o ../bin/basic
    $(CXX) $(COMMON) record.cc             -lmujoco -lglfw   -o ../bin/record

As I am on fedora I installed glfw through dnf

sudo dnf install glfw

but the its files are now in /usr/lib64/ where gcc does not see them (package information).

How should I proceed?

CodePudding user response:

The linked glfw package contains the compiled shared library only, but for development you also need glfw-devel package which contains the headers.

but the its files are now in /usr/lib64/ where gcc does not see them

It should see them, but that comes at play later during linking, the Makefile correctly adds -lglfw so it should work.

  • Related