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

Author Topic: Help with SFML Game Development book  (Read 1247 times)

0 Members and 1 Guest are viewing this topic.

twiggystardust

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help with SFML Game Development book
« on: September 23, 2013, 08:11:07 am »
Hello, I have recently started building the project in the book and I have made it to chapter 3. But I have a problem, I was presented with this error

sfmlapplication\aircraft.cpp(22): error C2027: use of undefined type 'ResourceHolder<Resource,Identifier>'
1>          with
1>          [
1>              Resource=sf::Texture,
1>              Identifier=Textures::ID
1>          ]

So I go take a look at where the error is, the code looks like:

20  Aircraft::Aircraft(Type type, const TextureHolder& textures)
21  : mType(type)
22  , mSprite(textures.get(toTextureID(type)))
23  {
24        sf::FloatRect bounds = mSprite.getLocalBounds();
25        mSprite.setOrigin(bounds.width / 2.f, bounds.height /2.f);
26  }

It seems that there is a problem with
mSprite(textures.get(toTextureID(type)))
and when I hover over textures with the mouse it pops up with "Error: incomplete type is not allowed" I have no idea why this would be, because as far as I can tell, other than the statistic stuff, my code is Identical to the code that was e-mailed to me. Also I did not include the string helper files, are those even needed? They aren't mentioned in the book so I figured they were for the statistics. Can anyone please help? I can't find any problems.
« Last Edit: September 23, 2013, 08:17:53 am by twiggystardust »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Help with SFML Game Development book
« Reply #1 on: September 23, 2013, 09:45:04 am »
It looks like an #include <Book/ResourceHolder.hpp> directive is missing.

In any case, can you try the newer code version from GitHub? Please follow the ReadMe file step by step carefully, in order to set everything up correctly.

« Last Edit: September 23, 2013, 09:47:27 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

twiggystardust

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help with SFML Game Development book
« Reply #2 on: September 24, 2013, 07:04:29 am »
Hello Nexus and thank you for you quick reply. I checked the code and you are correct. I did not include ResourceHolder.h. I had accidentally included the ResourceIdentifier.h and while I was comparing code, I must not have looked at that part close enough. Thank you very much again.

 

anything