SFML community forums

Help => General => Topic started by: lehthanis on July 28, 2017, 07:45:23 pm

Title: Yet another Failed to load font problem.
Post by: lehthanis on July 28, 2017, 07:45:23 pm
I'm having a hard time getting a font loaded.  I'm sure it's not a working directory problem because I've checked in my code that I'm manually applying the full path.  The error I get is:

S:\Documents\Visual Studio 2015\Projects\UDPJoySend\x64\Debug\arial.ttf
000007FEFA591120Failed to load font "

string workingdir()
{
        char buf[256];
        GetCurrentDirectoryA(256, buf);
        return string(buf) + '\\';
}

int main(int argc, char *argv[])
{
        RenderWindow window(VideoMode(800, 600), "UDP Joystick Sender");
        window.setFramerateLimit(10);
        string fontfile = workingdir() + "arial.ttf";
        cout << fontfile << "\n";
        if (!font.loadFromFile(fontfile))
        {
                cout << err;
                return 0;
        }

.......
        cout << "Exiting\n";
        return 0;
}

 

As you can see it's not telling me WHAT file name it's failing to load.  I've tried it with just the name of the font, and this working dir option.  The font exists in the path shown in the cout line before the error.  Thoughts?
Title: Re: Yet another Failed to load font problem.
Post by: eXpl0it3r on July 28, 2017, 08:10:30 pm
Are you mixing debug and release mode?
Title: Re: Yet another Failed to load font problem.
Post by: lehthanis on July 28, 2017, 09:12:03 pm
yeah I think I am...I'm running in debug mode but using non-debug sfml...would that do it?
Title: Re: Yet another Failed to load font problem.
Post by: eXpl0it3r on July 28, 2017, 09:16:21 pm
Yes, that will cause issues.