SFML community forums

Help => General => Topic started by: matz on March 01, 2013, 10:32:31 pm

Title: Using SFML with mac OS 10.6.8 and g++
Post by: matz on March 01, 2013, 10:32:31 pm
I'm trying to get SFML (64 bit) to work with g++ on my mac running 10.6.8. I'm avoiding xCode for a few reasons, first and foremost being I can't use c++11 with the current version of xcode on my mac (and I would have to play to upgrade, ugh).

That being said, I can't seem to figure out the process of installation/what to include on the command line in order to compile with g++. I tried following the normal 64 bit mac instructions for xcode, but after installing and using the following in g++:

g++ test.cpp -o test -framework sfml-window -framework sfml-graphics -framework sfml-system

I get:

Undefined symbols for architecture x86_64:
  "sf::Clock::GetElapsedTime() const", referenced from:
      _main in cc1VO6E6.o
  "sf::Sleep(float)", referenced from:
      _main in cc1VO6E6.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Has anyone had problems like this? I installed using the guide for xcode installation, but it doesn't seem like this would cause such an error. Suggestions?

EDIT: In case it is relevant, my code is just the example:

#include <SFML/System.hpp>
#include <iostream>

int main(){
        sf::Clock Clock;
        while(Clock.GetElapsedTime() < 5.f){
                std::cout << Clock.GetElapsedTime() << std::endl;
                sf::Sleep(0.5f);
        }
        return 0;
}
Title: Re: Using SFML with mac OS 10.6.8 and g++
Post by: MarcuzPwnz on March 02, 2013, 05:23:47 am
You can get the latest version of Xcode from the Mac app store for free.

It runs C++11 perfectly fine. :)
Title: Re: Using SFML with mac OS 10.6.8 and g++
Post by: Hiura on March 02, 2013, 05:05:20 pm
@MarcuzPwnz: I don't think the latest version of Xcode are available for 10.6 -> no C++11 support from Apple on this "old" system.


@matz: make sure your headers and binary match the same version of SFML. And upgrade to SFML 2.0, because 1.6 is sooo dead. (FAQ (https://github.com/SFML/SFML/wiki/FAQ#wiki-grl-version))