Adding libraries, header paths to G++

I am trying to add SFML to my C++ projects. I am running Mac OS, Emacs for my editor and G++ as my compiler. Emacs is just a text editor, so I need to add paths to my libraries and headers manually at compile time. Say that the graphics.hpp file is at /Users/Me/Documents/Project/SFML/graphics.hpp

The file graphics.hpp is basically just a file containing a whole bunch of #include dependencies that the graphics library needs. All of those dependencies are at /Users/Me/Documents/Project/SFML/Graphics/xxxx*

Here is my question, how do I tell G++ where the files I need to add to my project are? I realize this has been asked before, but when I tried to do what other users said to do it didn't work.

P.S. I tried running

g++ -L/Users/Me/Documents/Project/SFML/graphics.hpp
-I/Users/Me/Documents/Project/SFML/graphics Main.cpp -o Application
The error I got for this was ERROR: File SFML/Graphics.hpp could not be found.

*Where "xxxx" is the files name, for example, the Image.hpp, Rect.hpp or Shape.hpp files that the graphics.hpp file has #include references to.

Thanks to Repeater for solving this! :)
Last edited on
Assuming that the file /Users/Me/Documents/Project/SFML/Graphics.hpp exists,

g++ -I/Users/Me/Documents/Project/ Main.cpp -o Application

-L is for the location of library files.
-I is for the location of include files.



Last edited on
Topic archived. No new replies allowed.