Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [MAC]Terminal g++ fatal error: 'SFML/System.hpp' file not found(SOLVED)  (Read 6619 times)

0 Members and 1 Guest are viewing this topic.

kipbits

  • Newbie
  • *
  • Posts: 49
    • View Profile
Hey all, I'm having some trouble compiling some sfml in the terminal. I have compiled and run sfml in the terminal before, although that was a few months ago, and before i upgraded to El Capitan. I still seem to be able to run Xcode projects just fine; It is nice thought to be able to run small test directly in the terminal.

I'm getting the following error:

     mycomputer:sfmltest me$ g++ sfmltest2.cpp -lsfml-system
     sfmltest2.cpp:1:10: fatal error: 'SFML/System.hpp' file not found
     #include <SFML/System.hpp>
              ^
     1 error generated.


I think i have SFML installed correctly:
  • lib is in usr/local/lib
  • include is in usr/local/include
  • the contents of frameworks and extlibs are in Library/Frameworks

I got info on g++

    mycomputer:sfmltest me$ g++ -v
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin15.2.0
    Thread model: posix

and my $PATH

    mycomputer:sfmltest me$ echo $PATH
    /Users/me/perl5/perlbrew/bin:/Users/me/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin


I noticed that my install location wasnt included. Is this a problem? what is the point of the compiler flags -lsfml-system / -framework sfml-system?

I've tried both dylibs and framworks now, and i get the same error. and I'm hoping to get some advice before i go and screw up my default paths.

Thanks,
kipbits
« Last Edit: December 31, 2015, 06:19:39 pm by kipbits »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [MAC]Terminal g++ fatal error: 'SFML/System.hpp' file not found
« Reply #1 on: December 31, 2015, 01:10:07 pm »
There was a related question a few days ago: http://en.sfml-dev.org/forums/index.php?topic=19559.msg140951#msg140951

Note a few things:
 - No need to edit paths in principle.
 - dylibs & frameworks are mutually exclusive: you only one of them to use SFML.
 - -I, -L, -l & -framework are compiler flags; I'll let you RTFM to learn how to use them and what they mean. ;-)
 - but you usually want to use `-I/usr/local/include -L/usr/local/lib -lsfml-...`.
SFML / OS X developer

kipbits

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: [MAC]Terminal g++ fatal error: 'SFML/System.hpp' file not found
« Reply #2 on: December 31, 2015, 06:18:54 pm »
g++ sfmltest2.cpp -I/usr/local/include -L/usr/local/lib -lsfml-audio -lsfml-window -lsfml-system

Well That seemed to fix it. Thanks!

Funny before updating to El Capitan I could run it without the extra flags:
      g++ sfmltest2.cpp -lsfml-audio -lsfml-window -lsfml-system

Any Idea what they did with the new OS X?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [MAC]Terminal g++ fatal error: 'SFML/System.hpp' file not found(SOLVED)
« Reply #3 on: January 08, 2016, 02:29:31 am »
Nope, sorry. Maybe they changed the compilation flags when they built clang the last time (because you're not really using g++, are you?)...
SFML / OS X developer

 

anything