Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Peculiar Link Error?  (Read 2341 times)

0 Members and 1 Guest are viewing this topic.

WaterNode

  • Newbie
  • *
  • Posts: 8
    • View Profile
Peculiar Link Error?
« on: January 02, 2013, 07:57:03 am »
I am getting trouble from referencing a RenderWindow to another method.
I get this error:
error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
Here is the code in the main class that might assist you:
#include "stdafx.h"
stickman* player;
sf::RenderWindow window(sf::VideoMode(640, 640), "StickRPG");
player->draw(&window); // This is the piece of code that generates the error.
Here is the code in stdafx.h:
#ifndef STDAFX_H_
#define STDAFX_H_

#include "targetver.h"
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <stdio.h>
#include <tchar.h>
#include "stickman.h"

#endif /* STDAFX_H_ */
Here is the code in stickman.h:
#ifndef __STICKMAN_H_INCLUDED__
#define __STICKMAN_H_INCLUDED__

class stickman
{
public:
        stickman(int, int, int);
        virtual ~stickman();
        void draw(sf::RenderWindow *window);
protected:
        int size;
        double upperarmR;
        double upperarmL;
        double upperlegR;
        double upperlegL;
        double lowerarmR;
        double lowerarmL;
        double lowerlegR;
        double lowerlegL;
        double chest;
        sf::Sprite cs;
        sf::Sprite llr;
        sf::Sprite lll;
        sf::Sprite lal;
        sf::Sprite lar;
        sf::Sprite ull;
        sf::Sprite ulr;
        sf::Sprite ual;
        sf::Sprite uar;
        sf::Vector2f armr;
        sf::Vector2f arml;
        sf::Vector2f legr;
        sf::Vector2f legl;
        sf::Vector2f p;
        sf::Vector2f n;
};

#endif
Here is the method I am using in stickman.cpp:
void stickman::draw(sf::RenderWindow* window)
{
        this->cs.setPosition(this->n.x, this->n.y);
        this->ual.setPosition(this->n.x, this->n.y);
        this->uar.setPosition(this->n.x, this->n.y);
        this->ual.setRotation(315);
        this->ual.setRotation(45);
        window->draw(this->cs);
        window->draw(this->ual);
        window->draw(this->uar);
}

Thank you.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Peculiar Link Error?
« Reply #1 on: January 02, 2013, 08:09:04 am »
Do you link SFML statically? If so, do you define SFML_STATIC in your project settings?
Laurent Gomila - SFML developer

WaterNode

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Peculiar Link Error?
« Reply #2 on: January 02, 2013, 08:14:32 am »
I linked it dynamically, I believe. But I defined static in the preprocessor anyways.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Peculiar Link Error?
« Reply #3 on: January 02, 2013, 08:58:58 am »
So that's the problem. Your settings must be consistent (read the tutorial again if you don't know what you do).
Laurent Gomila - SFML developer

WaterNode

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Peculiar Link Error?
« Reply #4 on: January 03, 2013, 01:56:58 am »
So that's the problem. Your settings must be consistent (read the tutorial again if you don't know what you do).
I never knew it mattered, thank you.

 

anything