Setup
Mingw
Windows 10
Problem
Error undefined reference to `_imp___ZN2sf4Font12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
Can't figure out the problem because the .ttf file is in the folder that the program i'm compiling is in.
Command I used
g++ main.cpp -IC:\Development\SFML-2.3.1\include -LC:\Development\SFML-2.3.1\lib -lsfml-graphics -lsfml-window -lsfml-system -o a.exe
Code
#include <SFML/Graphics.hpp>
#include <iostream>
//#include "intro.h"
int main()
{
sf::RenderWindow Window(sf::VideoMode::getDesktopMode(),"Hello Window");
sf::Font font;
if(!font.loadFromFile("bit.ttf"))
{
std::cout << "No Work";
}
sf::Text text("hello", font);
text.setCharacterSize(30);
text.setStyle(sf::Text::Bold);
text.setColor(sf::Color::Red);
while(Window.isOpen())
{
sf::Event Event;
while(Window.pollEvent(Event))
{
if(Event.type == sf::Event::Closed)
{
Window.close();
}
}
// Declare and load a font
// Create a text
// Draw it
Window.draw(text);
Window.clear(sf::Color());
Window.display();
}
}