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

Author Topic: [SOLVED]Linking issues - MacOSX  (Read 1597 times)

0 Members and 1 Guest are viewing this topic.

Windy

  • Newbie
  • *
  • Posts: 4
    • View Profile
[SOLVED]Linking issues - MacOSX
« on: July 12, 2014, 01:09:31 pm »
Hi, I hate to join to ask for help but I can't work this one in particular out for myself.

Using SFML 2.1 (installed via Homebrew) on a MaxOSX 10.9. I'm using SCONS to compile through terminal using these settings:

Quote
env = Environment()
env.Append(CPPFLAGS='-stdlib=libc++')
env.Append(CCFLAGS='-stdlib=libc++')
env.Append(LIBS = ['sfml-network','sfml-graphics', 'sfml-window'])
env.Append(LIBPATH = ['/usr/lib', '/usr/local/lib'])
env.Program(target = 'Game', source = ['Main.cpp'])

But when I try to open a window with:   Window window(VideoMode(800, 600), "My window");

I get the error:

Quote
Undefined symbols for architecture x86_64:
  "sf::String::String(char const*, std::__1::locale const&)", referenced from:
      _main in Main.o

Now, I do not get this error everywhere. I have no issue using the Network component of SFML to use TCPSockets and Listeners to do stuff with Telnet and such. It's just this one particular component so far.

I've done everything I can think off, including reinstalling command line tools and trawling the internet. The reason I'm using '-stdlib=libc++' flags is because a previous thread here suggested it.
« Last Edit: July 12, 2014, 03:14:18 pm by Windy »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking issues - MacOSX
« Reply #1 on: July 12, 2014, 01:41:00 pm »
Are you compiling with clang?
Laurent Gomila - SFML developer

Windy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking issues - MacOSX
« Reply #2 on: July 12, 2014, 01:45:23 pm »
Quote
clang++ -o bin/main.o -c -stdlib=libc++ -stdlib=libc++ src/main.cpp
clang++ -o bin/Game bin/main.o -L/usr/lib -L/usr/local/lib -lsfml-network -lsfml-graphics -lsfml-window -lfreetype -lsndfile
Undefined symbols for architecture x86_64:
  "sf::String::String(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::locale const&)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64

Yes I am. Scons defaults to it but I just added a line to make sure.

Windy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking issues - MacOSX
« Reply #3 on: July 12, 2014, 01:59:30 pm »
Quote
#include <string>
#include <SFML/Window.hpp>

using namespace std;

/*
This is to start the main loop and to segment the game from
*/
int main(){
  string h = "My Window";
  sf::Window window(sf::VideoMode(800, 600), h);
  return 0;
}

Just realized that it might be helpful to show what I am doing. I broke it down to as small as I possibly could to test it.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Linking issues - MacOSX
« Reply #4 on: July 12, 2014, 02:29:26 pm »
Edit your SConstruct file and add 'sfml-system' to the end of the LIBS line, like so:

env.Append(LIBS = ['sfml-network','sfml-graphics', 'sfml-window', 'sfml-system'])

Windy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking issues - MacOSX
« Reply #5 on: July 12, 2014, 03:10:57 pm »
Thank you so much. It worked perfectly. I can't believe the answer was that simple.

 

anything