Help with SFML Game Development book

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

1
2
3
4
5
6
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:

1
2
3
4
5
6
7
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, my code is Identical to the example code that was e-mailed to me for the book. Can anyone please help? I can't find any problems. If you need more code than this let me know
Last edited on
My guess would be that you're missing an #include.

I see you've already posted this in the relevant SFML forum. I would expect you have a better chance of getting a definitive response there as the authors frequent the forum.
Yes cire, I was missing an include. Actually, I included the wrong one, and while I was comparing the code to the example code, I didn't look close enough to notice it was not the right include file
Topic archived. No new replies allowed.