Help with SFML Game Development book
Sep 23, 2013 at 6:16am UTC
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
2 3 4 5 6
sfmlapplication\aircraft.cpp(22): error C2027: use of undefined type
So I go take a look at where the error is, the code looks like:
2 3 4 5 6 7
20 Aircraft::Aircraft(Type type,
const TextureHolder& textures)
21 : mType(type)
22 , mSprite(textures.get(toTextureID(type)))
24 sf::FloatRect bounds = mSprite.getLocalBounds();
25 mSprite.setOrigin(bounds.width / 2.f, bounds.height /2.f);
It seems that there is a problem with
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
Sep 23, 2013 at 6:17am UTC
Sep 23, 2013 at 6:30am UTC
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.
Sep 24, 2013 at 5:07am UTC
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.