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

Author Topic: Undefined references  (Read 10472 times)

0 Members and 1 Guest are viewing this topic.

szopen

  • Newbie
  • *
  • Posts: 3
    • View Profile
Undefined references
« on: December 12, 2018, 09:39:38 am »
Hi,

Here's what I've been doing:


export SFML_DIR=/usr/local/lib/cmake/SFML
cmake .
make clean # just to make sure
make

Everything seems to build fine, libraries are installed in /usr/local/lib

However, when I try to build an example program from go-sfml packare using csfml, i got:

XXXXX:~/go/src/gopkg.in/teh-cmc/go-sfml.v24/examples/gosfml_example_c$ make

gcc -L /usr/lib64/ -lsfml-audio -lsfml-graphics -lcsfml-system -lsfml-system -lcsfml-window -lsfml-window -I/root/go/src/gopkg.in/teh-cmc/go-sfml.v24/examples/gosfml_example_c/../../CSFML/include -o go-sfml -lcsfml-audio -lcsfml-graphics main.c
/usr/local/lib/libcsfml-audio.so: undefined reference to `sf::SoundStream::onLoop()'
/usr/local/lib/libcsfml-graphics.so: undefined reference to `sf::RenderWindow::setActive(bool)'

I tried to use different -l order (i.e. -lsfml-audio -lcsfml-audio, -lcsfml-audio -lsfml-audio, main.c before everything else and several other combinations) and still have no success.

ld /usr/local/libcsfml-audio.so:

/usr/local/lib/libcsfml-audio.so: undefined reference to `sf::Sound::getStatus() const'
/usr/local/lib/libcsfml-audio.so: undefined reference to `sf::SoundSource::getVolume() const'
/usr/local/lib/libcsfml-audio.so: undefined reference to `sf::SoundBuffer::getSamples() const'
/usr/local/lib/libcsfml-audio.so: undefined reference to `sf::Sound::getPlayingOffset() const'
.....

Tens more follow.

I have a hunch that it would be enough to change SFMLconfig.cmake to point to a different directory, but I have no idea about cmake syntax

szopen

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undefined references
« Reply #1 on: December 12, 2018, 09:43:06 am »
I have no idea what actually helped, but I've downloaded SFML sources, cmake + make + make install, changed CMakeConfig removing first two entries and inserting "/usr/local/lib" there instead, changed the makefile for the project, during run set LD_LIBRARY_PATH and it finally run...

szopen

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undefined references
« Reply #2 on: December 12, 2018, 10:03:34 am »
OK, I've found the root cause of all the problems: seems that the conflicts were caused by the standard sfml rpms installed on my system. I've removed them and everything now seems to work fine (except that all go programs using go-sfml crash, but this is issue not related to csfml)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Undefined references
« Reply #3 on: December 12, 2018, 12:26:19 pm »
You seem to have figured it out on your own by now.

Just wanted to confirm that yes, if you get undefined references of SFML functions in CSFML, then the cause is different versions, i.e. CSFML trying to find symbols in SFML, which were added only in newer SFML versions.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything