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.


Topics - Stewbond

Pages: [1]
1
General / Linking errors
« on: February 20, 2012, 08:29:50 pm »
I'm running SFML 2.0 with VS2010.  I've done a few SFML projects before so the libraries themselves should be good.  I am trying to statically link some libraries but can't figure out what is wrong.

This will compile:
Code: [Select]
#include <SFML/System.hpp>
int main()
{
sf::Clock Clock;
Clock.GetElapsedTime();
return 0;
}


But as soon as I do:
Code: [Select]
#include <SFML/Window.hpp>
int main()
{
sf::Window App;
return 0;
}


I get 27 linking errors of the form:
Code: [Select]
xxxx.lib(XXXX.dll) : error LNK2005: XXXXXXX already defined in XXXX.lib(XXXXX.dll)
and
Code: [Select]
: fatal error LNK1169: one or more multiply defined symbols found

I have the libraries linked as additional dependancies. I've tried /NODEFAULTLIB as the warnings recommend, but that causes more errors. I've also defined SFML_STATIC and STATIC_STD_LIBS in my Preprocessor.  I've also tried it without STATIC_STD_LIBS with no change.

Am I missing something?

2
Graphics / RenderWindow object crashes during Graphics Tutorial.
« on: October 08, 2011, 01:47:45 pm »
Hello,

I'm on my second day of learning SFML.  I got through the window tutorial without issue, however I am having problems with the graphics tutorial.  Sample code from the sprites tutorial is given below.  I can compile this without issue, however when I run this, the program crashes when I use
    App.GetEvent(Event)
    App.Clear()
    App.Display()
    App.Close()

These worked fine when App was defined as sf::Window but doesn't work with sf::RenderWindow.  I've read through the forums a bit and found that someone had a similar problems which were solved by updating their video card driver.  I've run other games on this PC with more complicated graphics so I'm not sure why my video-card would not work for this very specific case.  Regardless I've tried updating my driver and found that it is the most recent one available.  I've also read that someone needed to re-compile SFML 1.6 for VC++ 2010 because his definition of the RenderWindow didn't work.  I'm not sure quite how to do that, but my RenderWindow definition works so I don't think that is the problem.

Does anyone have any ideas?  I am running SFML 1.6 (built for VC++ 2008) with MS Visual C++ 2010 in Windows 7.  I'm compiling in Debug mode. I'm using the SFML release libraries and DLLs.  My video card is an NVIDIA GeForce 8600 GT with NVIDIA driver version 8.17.12.6099.

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    sf::Image Image;
    if (!Image.LoadFromFile(".//Images//Katie.png")) //This file exists and is loaded.
        return EXIT_FAILURE;

    sf::Sprite Sprite(Image);

    Sprite.SetColor(sf::Color(0, 255, 255, 128));
    Sprite.SetPosition(200.f, 100.f);
    Sprite.SetScale(2.f, 2.f);

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event)) // This line crashes
            if (Event.Type == sf::Event::Closed) App.Close();

        float ElapsedTime = App.GetFrameTime();

        if (App.GetInput().IsKeyDown(sf::Key::Left))  Sprite.Move(-100 * ElapsedTime, 0);
        if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.Move( 100 * ElapsedTime, 0);

        App.Clear(); // This line crashes
        App.Draw(Sprite);
        App.Display(); // This line crashes
    }
    return EXIT_SUCCESS;
}


[EDIT:] Here is the debug error provided by Visual Studio's Debug tool:
A buffer overrun has occurred in GraphicsTutorial.exe which has corrupted the program's internal state.

Pages: [1]