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 - hoenchioma

Pages: [1]
1
Graphics / Linking error (LNK 2019) with sf::Sprite
« on: November 02, 2018, 09:58:16 pm »
After working with a project for quite while now using SFML these come up.
Code: [Select]

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2019    unresolved external symbol "declspec(dllimport) public: thiscall sf::Sprite::Sprite(class sf::Sprite &&)" (imp_??0Sprite@sf@@QAE@$$QAV01@@Z) referenced in function "public: thiscall Boss2::Undead::Undead(class Boss2::Undead &&)" (??0Undead@Boss2@@QAE@$$QAV01@@Z)    Somber    C:\Users\\Documents\Visual Studio 2017\TEAM\Somber\Boss2.obj    1
Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2019    unresolved external symbol "declspec(dllimport) public: class sf::Sprite & thiscall sf::Sprite::operator=(class sf::Sprite &&)" (imp_??4Sprite@sf@@QAEAAV01@$$QAV01@@Z) referenced in function "public: class Boss2::Undead & thiscall Boss2::Undead::operator=(class Boss2::Undead &&)" (??4Undead@Boss2@@QAEAAV01@$$QAV01@@Z)    Somber    C:\Users\\Documents\Visual Studio 2017\TEAM\Somber\Boss2.obj    1

Here Undead is a class with a constructor like,
Code: [Select]
Undead(sf::Texture *texture1, sf::Texture *texture2, sf::Texture *texture3);
It has an sf::Sprite member. This sets one of the 3 textures to the sprite member based on some internal calculations.
Then I've used a vector of it (in another class/file) and pushed versions of it like this
Code: [Select]
std::vector <Undead> zombies;
zombies.push_back(Undead(&undeadTexture1, &undeadTexture2, &undeadTexture3));

What's worse is that it compiles and runs fine on my friends computer. The same code. I've tried to mimic all configurations his VS / SFML setup has to no avail. I even re-downloaded and setup SFML.

Few things:
1. SFML version : 2.5.0
2. Visual Studio 2017
3. I've not set SFML_STATIC (I don't want or need static linking)
4. All the sfml dlls are in the folder where the .exe file is supposed to be
5. I haven't faced this issue before in SFML and I've been using SFML for quite a while now.
(provided I did not have to make a vector of objects with sf::Sprite objects as members)
6. It works fine on my friends computer (same SFML version and VS)

2
When using the Clock::getElapsedTime() or restart() I noticed something weird.

        RenderWindow window(VideoMode(700, 700), "Hello SFML");
        Event event;
        Clock clock;
        Clock clock2;
        Clock c3;
       
        RectangleShape box(Vector2f(20, 20));

        //window.setFramerateLimit(30);

        while (window.isOpen())
        {      
                while (window.pollEvent(event))
                {
                        if (event.type == Event::EventType::Closed)
                        {
                                window.close();
                        }
                }
                box.move(0, 0.5 * clock.restart().asMilliseconds());
                clock.restart();

                if (box.getPosition().y > 700)
                {
                        cerr << clock2.getElapsedTime().asSeconds() << endl;
                        window.close();
                }

                window.clear();

                window.draw(box);

                window.display();
        }
 

The code seems simple enough it outputs how much the box takes to move across the screen. Moving a box to down. I was trying to implement frame rate independent movement. This produces weird jagged movement. And the measured time varying at each run (3-6 seconds). So I decided to measure the elapsed time to see whats going on.
        box.move(0, 0.5 * clock.getElapsedTime().asMilliseconds());
        cerr << clock.restart().asMilliseconds() << endl;
 
Suddenly the movement was fixed and the time taken seemed to average to around 1.76 seconds.
This was so at any framerate I set (as it should be). But as soon as i commented out the second line the same happened again.
What's even more weird is that this doesn't seem to happen when I use asMicroseconds().
Is this me or what could be causing this. I'm running this on a Windows 10 64 bit machine (developing for 32 bit machines) if that helps.

Pages: [1]
anything