SFML community forums

Help => General => Topic started by: Pfhreak on September 16, 2007, 01:20:17 am

Title: Strange characters in Title bar
Post by: Pfhreak on September 16, 2007, 01:20:17 am
I'm using the code from the graphics tutorial. I keep getting these strange characters in my title bar.

ÌÌÌÌSFML Test


This is a win32 application (not console.) I've linked sfml-graphics.lib, sfml-main.lib, sfml-window.lib, and sfml-system.lib in that order.

Code: [Select]

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

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{

    // Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Test",sf::Window::Fixed);

    // Change background color to red
    App.SetBackgroundColor(sf::Color(0, 0, 0));

    // Start game loop
    bool Running = true;
    while (Running)
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Close)
                Running = false;

            // A key has been pressed
            if (Event.Type == sf::Event::KeyPressed)
            {
                // Escape key : exit
                if (Event.Key.Code == sf::Key::Escape)
                    Running = false;

                // F1 key : capture a screenshot
                if (Event.Key.Code == sf::Key::F1)
{
sf::Image Screen = App.Capture();
Screen.SaveToFile("screenshot.jpg");
}
            }
        }

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}
Title: Strange characters in Title bar
Post by: jbadams on September 16, 2007, 09:53:28 am
Sounds like exactly the same problem as in this thread (http://sfml.sourceforge.net/forum/viewtopic.php?t=24).

Have you linked with the correct version of the libraries, and if you're currently compiling in debug mode are you using the debug versions (which end with "-d")?  When asking for help it can also be useful to let us know which programming environment and compiler you're using.

Hope that helps.  :)
Title: Strange characters in Title bar
Post by: Pfhreak on September 16, 2007, 07:47:55 pm
Sorry, I'm using Visual Studio 2005.

I'm compiling in debug mode, but with the regular libraries.

If I change the libraries to their -d equivalents I get over 200 linker errors.
My only thought is that I somehow installed it wrong?

Here's what I did:
Copied the items in the vc2005/lib/static folder to my VC/lib folder.
Copied the SFML folder to my VC/Include folder.

Then I added the pieces I wanted to my linker:
sfml-graphics.lib sfml-main.lib sfml-windows.lib sfml-system.lib

Then I had to exlude the following from my linker:
msvcrtd.lib

That is ALL I did, are there any other steps? Am I missing something here?

EDIT:
If I try and build a release version using the libraries, I get this error:
Code: [Select]

fatal error C1047: The object or library file 'G:\Development\Microsoft Visual Studio 8\VC\lib\sfml-graphics.lib' was created with an older compiler than other objects; rebuild old objects and libraries
Title: Strange characters in Title bar
Post by: Mindiell on September 16, 2007, 08:08:15 pm
If you are compiling in debug mode, you have t ouse the -d libraries.
When you link the libraries you have to do it in the good order :
-lsfml-graphics-d
-lsfml-window-d
-lsfml-system-d
Title: Strange characters in Title bar
Post by: Pfhreak on September 16, 2007, 08:25:08 pm
Quote from: "Mindiell"
If you are compiling in debug mode, you have t ouse the -d libraries.
When you link the libraries you have to do it in the good order :
-lsfml-graphics-d
-lsfml-window-d
-lsfml-system-d


Yes, this is true. This works fine if I am trying to do a console application. Although it does generate 19 linker warnings.

I don't want that console window to pop up, so I made a win32 application. The tutorials say that I can include sfml-main.lib and just use int main() as an application starting point. Is there a better way to accomplish this?
Title: Strange characters in Title bar
Post by: Laurent on September 17, 2007, 09:06:24 am
Quote
If I change the libraries to their -d equivalents I get over 200 linker errors.

Which errors ?

Quote
Yes, this is true. This works fine if I am trying to do a console application. Although it does generate 19 linker warnings.

Which warnings ?
Title: Strange characters in Title bar
Post by: FallingSky on October 11, 2007, 05:35:01 pm
Quote from: "Pfhreak"
Sorry, I'm using Visual Studio 2005.

I'm compiling in debug mode, but with the regular libraries.

If I change the libraries to their -d equivalents I get over 200 linker errors.
My only thought is that I somehow installed it wrong?

Here's what I did:
Copied the items in the vc2005/lib/static folder to my VC/lib folder.
Copied the SFML folder to my VC/Include folder.

Then I added the pieces I wanted to my linker:
sfml-graphics.lib sfml-main.lib sfml-windows.lib sfml-system.lib

Then I had to exlude the following from my linker:
msvcrtd.lib

That is ALL I did, are there any other steps? Am I missing something here?

EDIT:
If I try and build a release version using the libraries, I get this error:
Code: [Select]

fatal error C1047: The object or library file 'G:\Development\Microsoft Visual Studio 8\VC\lib\sfml-graphics.lib' was created with an older compiler than other objects; rebuild old objects and libraries


I had the same problem many times, try doing a full rebuild... Build->Rebuild