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

Author Topic: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...  (Read 4035 times)

0 Members and 2 Guests are viewing this topic.

abisi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hello,


I do not really know how to address this request for help, as I am very new and unexperienced in programming and informatics. Yet my assistants are unable to help me at school so I am turning to the community.

I am doing a project in one of my course. We are a group of 11 people in the same project, and we use git to work on this project. One of my partner coded classes, methods, a big piece of code with SFML. I have installed myself SFML but when I try to build with cmake . , the generating is done. Yet when I do 'make', it seems that some functionalities of SFML are unfound, as I get the following error. (I must precise that this does not appear on my partner's computer, we both use Mac - I think someone installed SFML for her).

The message reads Logo, Axes which are classes coded by my partner. The first line brings to a method of SFML that is not found, I believe ?

I must say that any kind of help would be more than helpful, as this prevents me from executing my main and working on my project. I am sure that you might need some more informations in order to help me, I am very responsive so feel free to ask.

Precisions :
I am using Mac OS, Geany as editor, CMake, coding in C++.
(The picture should be included.)
« Last Edit: November 22, 2016, 10:00:06 am by abisi »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...
« Reply #1 on: November 22, 2016, 09:48:21 am »
Hi

First, please don't create useless polls... then check your post and you'll see that your TIFF image doesn't show. Please use a more common format (PNG), or even better: copy-paste the errors as text.
Laurent Gomila - SFML developer

abisi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...
« Reply #2 on: November 22, 2016, 09:59:10 am »
Of course, it's just that I did not know how to provide the necessary informations or which informations.

Here is the error I get while making :

[ 14%] Linking CXX executable Main
Undefined symbols for architecture x86_64:
  "sf::Font::loadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      Logo::afficher_logo(std::vector<Motif, std::allocator<Motif> >) in Logo.cpp.o
  "sf::String::String(char const*, std::locale const&)", referenced from:
      Logo::afficher_logo(std::vector<Motif, std::allocator<Motif> >) in Logo.cpp.o
  "sf::Texture::loadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)", referenced from:
      Logo::Logo()  in Logo.cpp.o
      Logo::Logo()  in Logo.cpp.o
      Axes::Axes()  in Axes.cpp.o
      Axes::Axes()  in Axes.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Main] Error 1
make[1]: *** [CMakeFiles/Main.dir/all] Error 2
make: *** [all] Error 2

Again, Logo and Axes are classes created by someone in my group. Yet I do not understand why CMake does not find (if indeed it means that it does not find) the methods in Font.
Thanks again for all kind of help I should receive.
« Last Edit: November 22, 2016, 10:01:19 am by abisi »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...
« Reply #3 on: November 22, 2016, 12:27:59 pm »
When compiling your project, make sure to use the same tools that were used to compile SFML. I.e. the same brand of compiler & std lib. Recompiling SFML to match your environment is also an option.
SFML / OS X developer

abisi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...
« Reply #4 on: November 22, 2016, 02:05:20 pm »
Hello,


Thank you for answer.
I am using CMake and my CMakeLists.txt should include SFML. My project contains the cmake module FindSFML.cmake so that it knows where to find SFML. (Is that correct ?) From then I do not understand what I should do, as I compile on the terminal. So how could I compile SFML in order to match my environment, for example, from the terminal ?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Undefined symbols for architecture x86_64:"sf::Font::loadFromFile...
« Reply #5 on: November 22, 2016, 10:40:50 pm »
Compiling SFML has nothing to do with how your project is compiled. It's really a separate process. Have a look at the tutorial: http://www.sfml-dev.org/tutorials/2.4/compile-with-cmake.php
SFML / OS X developer

 

anything