Including headers from / usr / local / include and libraries from / usr / local / lib

I just installed GLFW on OS X 10.9. The headers were set to /usr/local/include

, and the library was set to /usr/local/lib

.

I'm wondering what else I need to do to get my C ++ program to include the type headers #include "GLFW/glfw3.h"

rather than specifying the entire path like #include "usr/local/include/GLFW/glfw3.h"

.

The same happens with the library because at the moment I cannot link the library with -lglfw3

. Thanks in advance.

+3


source to share


1 answer


You would -I /usr/local/include

pass it to the compiler as a preprocessor flag and -L /usr/local/lib

to the compiler as a linker flag. So to build one source application, small.cc

compile as

  g++ -Wall -I /usr/local/include -L /usr/local/lib \
      small.cc -o small -lglfw3

      

If the building with make

has



  CXXFLAGS += -I/usr/local/include
  LDFLAGS += -L/usr/local/lib

      

in Makefile

If you are using shared libraries add once /usr/local/lib

in /etc/ld.so.conf

and run ldconfig

(at least on Linux).

+6


source







All Articles