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

Author Topic: [SOLVED] Build error: undefined reference to `sf::Text::setFillColor()  (Read 2729 times)

0 Members and 1 Guest are viewing this topic.

richchigga

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi! I am currently working on a project using sfml. I am making a mainmenu with sf::Text and using
this->title->setFillColor
which works on OS X.
I have been developing on OS X and the code runs fine, but when im trying to run the code on my computer, which is running Elementary OS in VM, the code comes with an error:

CMakeFiles/Project.dir/Source_Files/States/stateMainMenu.cpp.o: In function `stateMainMenu::render(sf::RenderWindow*)':
/home/richchigga/Project/Source Files/States/stateMainMenu.cpp:90: undefined reference to `sf::Text::setFillColor(sf::Color const&)'
/home/richchigga/Project/Source Files/States/stateMainMenu.cpp:91: undefined reference to `sf::Text::setFillColor(sf::Color const&)'
/home/richchigga/Project/Source Files/States/stateMainMenu.cpp:92: undefined reference to `sf::Text::setFillColor(sf::Color const&)'
/home/richchigga/Project/Source Files/States/stateMainMenu.cpp:93: undefined reference to `sf::Text::setFillColor(sf::Color const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/Project.dir/build.make:510: recipe for target 'Project' failed
make[3]: *** [Project] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Project.dir/all' failed
make[2]: *** [CMakeFiles/Project.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/Project.dir/rule' failed
make[1]: *** [CMakeFiles/Project.dir/rule] Error 2
Makefile:118: recipe for target 'Project' failed
make: *** [Project] Error 2
 
When changing the code to
this->title->setColor(sf::Color::Blue);

it runs fine.

Please help, i can not seem to find the problem.
If you have further questions, just ask.
Thanks in advance!
« Last Edit: November 01, 2016, 05:01:06 pm by richchigga »

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
You probably have the wrong version of SFML set up on your VM. Versions 2.4.0+ have deprecated the use of some functions, including setColor. It was replaced with setFillColor.

richchigga

  • Newbie
  • *
  • Posts: 3
    • View Profile
I downloaded the latest SFML files from the site, SFML-2.4.0 and extracted as said in the description.

richchigga

  • Newbie
  • *
  • Posts: 3
    • View Profile
Well, i fixed it now. Installed SFML through command line and oddly enought it installed the 2.0 version. Had to edit the CMAKE FLAGS to /usr/local lib and includes.

 

anything