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

Author Topic: undefined type sf::Texture  (Read 1901 times)

0 Members and 1 Guest are viewing this topic.

short

  • Newbie
  • *
  • Posts: 9
    • View Profile
undefined type sf::Texture
« on: September 15, 2011, 08:19:40 am »
Hi there,

I compiled sf 2.0 using visual studio 2010, and I went to #include <SFML\Graphics\Sprite.hpp> which gets loaded correctly.

When I compile my program (with this file being included) I get the following errors:

Code: [Select]

c:\sfml 2.0\include\sfml\system\resourceptr.inl(60): error C2027: use of undefined type 'sf::Texture'
2>          c:\sfml 2.0\include\sfml\graphics\renderer.hpp(42) : see declaration of 'sf::Texture'
2>          c:\sfml 2.0\include\sfml\system\resourceptr.inl(58) : while compiling class template member function 'sf::ResourcePtr<T>::~ResourcePtr(void)'
2>          with
2>          [
2>              T=sf::Texture
2>          ]
2>          c:\sfml 2.0\include\sfml\graphics\sprite.hpp(207) : see reference to class template instantiation 'sf::ResourcePtr<T>' being compiled
2>          with
2>          [
2>              T=sf::Texture
2>          ]
2>c:\sfml 2.0\include\sfml\system\resourceptr.inl(60): error C2227: left of '->Disconnect' must point to class/struct/union/generic type
2>
2>Build FAILED.


I will post the file, just for completeness (it is small). Currently I have every instance of the sprite i want to initialize commented out, so I'll leave it like that.

Code: [Select]
#ifndef _SPRITECOMPONENT_HPP_
#define _SPRITECOMPONENT_HPP_
#include <string>
#include <SFML\Graphics\Sprite.hpp>
#include "../System/IComponent.hpp"
#include "../System/ISystemLog.hpp"
namespace Components
{
class SpriteComponent : public IComponent
{
public:

SpriteComponent(const sf::Sprite sprite) : IComponent("Sprite")//, _sprite(sprite)
{

}

~SpriteComponent() { }

/*const sf::Sprite GetSprite() const
{
return _sprite;
}*/

// abstract overrides
void SetProperties(std::map<std::string, boost::variant<int, std::string> > properties)
{
//_sprite = boost::get<sf::Sprite>(properties["sprite"]);
}

void Update() { }

private:
//sf::Sprite _sprite;
};

}

#endif


I'm running windows 7, with visual studio 2010. I am developing in C++.

Does anyone see anything that would point to why it thinks sf::Texture is undefined??

Thanks,
Short

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
undefined type sf::Texture
« Reply #1 on: September 15, 2011, 08:47:22 am »
Laurent Gomila - SFML developer

short

  • Newbie
  • *
  • Posts: 9
    • View Profile
undefined type sf::Texture
« Reply #2 on: September 16, 2011, 03:16:16 am »
Thank you for all the work you've done, do not apologize!!

 

anything