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.


Messages - sjames

Pages: [1]
1
General / Unresolved external symbol
« on: November 01, 2021, 04:29:36 pm »
I am getting the following error:
Quote
unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default
after some debugging I found out that the function window.draw() causes it. I think that it might be something wrong with my linking since it works just fine in release mode.

#include <SFML/Graphics.hpp>
#include "Graphics.h"

using namespace sf;
using namespace std;

sf::Texture grey;
sf::Texture green;

int main()
{
int size = 75;
        RenderWindow window(VideoMode(750, 750), "Chess");

        Event event;
        void CreateTextures();
        while (window.isOpen()) {

                while (window.pollEvent(event)) {

                        if (event.type == Event::Closed) {

                                window.close();
                        }
                }

                window.clear(Color::Black);

                std::vector<Sprite> sprites(64);
                for (int y = 0; y < 8; y++)
                {
                        for (int x = 0; x < 8; x++)
                        {
                                int index = y * 8 + x;
                                if (index % 2 == 0)
                                {
                                        sprites.at(index).setTexture(grey);
                                        sprites.at(index).setPosition(75 + x * size, 75 + y * size);
                                        window.draw(sprites.at(index)); // ERROR
                                }
                                else
                                {
                                        sprites.at(index).setTexture(green);
                                        sprites.at(index).setPosition(75 + x * size, 75 + y * size);
                                        window.draw(sprites.at(index)); // ERROR
                                }
                        }
                }
                window.display();
        }
        return 0;
}

void CreateTextures()
{
        Uint8* pixels = new Uint8[75 * 75 * 4];

        //Creating Grey Texture
        grey.create(75, 75);
        for (int i = 0; i < 75 / 2; i += 4)
        {
                pixels[i] = 188;
                pixels[i + 1] = 150;
                pixels[i + 2] = 86;
                pixels[i + 3] = 255;
        }
        grey.update(pixels);

        //Creating Green Texture
        green.create(60, 75);
        for (int i = 0; i < 75 / 2; i += 4)
        {
                pixels[i] = 188;
                pixels[i + 1] = 150;
                pixels[i + 2] = 86;
                pixels[i + 3] = 255;
        }
        green.update(pixels);
}
(No, the code is not working properly. I still have to debug it but I need to be able to compile it first)

edit: These are the .lib's that I link:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
sfml-audio-d.lib
sfml-network-d.lib

Pages: [1]