This topic is 3494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Never mind. I forgot to include a SDL header in the header. Not sure why it worked when I put it in 1 header though.

##### Share on other sites
Is the move function actually empty? It may be something in there.

##### Share on other sites
It wouldn't have worked when you put it in the header, there was no translation unit actually being compiled that included Objects.h. :)

Edit: Please don't edit out the original question from a post. It makes it hard for people to understand what all our replies are about. :(

##### Share on other sites
The compiler doesn't seem to know about SDL_Surface yet. You must either include the SDL header in your header, or before your header in the cpp-file (which isn't as good, since this way you will always be depending on that).

Since you use a pointer it's enough to tell the compiler that SDL_Surface is a class, which is recommended since your header won't require the SDL header in that case.
You do this by just adding the line:
class SDL_Surface;

before your Unit class definition. The compiler doesn't actually need to know what the SDL_Surface class is, as long as you use a pointer, it only needs to know that it's the address to some class called SDL_Surface. You still need to include the SDL header in any cpp-file where you actually use the members of the class pointed to.

EDIT: Oh way too late, you solved it while I was typing =)

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5

• 27
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631737
• Total Posts
3001944
×