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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PhrayShow

Pages: [1]
1
Graphics / Re: Problem loading font SFML 2
« on: July 28, 2015, 02:44:42 am »
Hi lorence, thanks for the reply. My problem was in fact similar to yours. I think I have download SFML 2.3.1 for gcc 4.8.1 compiler when I was actually using gcc 4.7.1 After downloading the right SFML package it worked well.

Thanks!

2
Graphics / [Solved]Problem loading font SFML 2
« on: July 27, 2015, 04:20:58 am »
Hi, I am new to C++ and have recently started to study SFML too. After I've followed all the steps in order to create a dynamically linked SFML project on Code::Blocks, I was able to make some basic coding such as creating a window, printing shapes, using user imput to move shapes, etc. but when I  tried to put some text on the screen I got the error message:

"C:\CPP\IntroductionSFML\main.cpp|10|undefined reference to `_imp___ZN2sf4Font12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE|".

The line to which it reffers is this:

font.loadFromFile("arial.ttf");

Here is the code I'm trying to compile (I reduced it to the minimum, but at first I was trying to use text in a bigger code):

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


int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML Application");

sf::Font font;
font.loadFromFile("arial.ttf");


sf::Text text("Hello!", font, 30);
text.setPosition(50,50);
text.setColor(sf::Color::Green);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(text);
window.display();
}
}

I think this problem is not related to the directory where I've put the font file, because when I tried to run the following code, I've got the exactly same message.

if (!font.loadFromFile("arial.ttf"))
{
    // error...
}
 



As I said before, SFML worked perfectly well when I was using other resources, such as shapes, window, events, keyboard, etc.

Please, could you help me finding out what is the problem?


Pages: [1]
anything