Multiple File compilation

I hope that this is an OK place to ask this.

I'm having trouble with compiling multiple files. This is one of the errors I'm getting:

swpcards.cpp:4: error: ‘card’ was not declared in this scope



My code for swpcards.cpp is below. "card.h" is a class definition for a playing card. I'm not sure how to define card here.

1
2
3
4
5
6
7
8
9
10
#include "swpcards.h"
#include "card.h"

void swpcards (card &thiscard, card &thatcard){
	// Swap two cards
	card tempcard;
	tempcard = thiscard;
	thiscard=thatcard;
	thatcard=tempcard;
}



Any help will be greatly appreciated!

Thanks in advance!
You fix that by including card.h, where the declaration of the card class is supposed to be.
Possible problems:

1. compiler can't find card.h file. If it is in a different directory from swpcards.cpp you will need to either put a path to it in your #include or in your compiler's include path
2. card is in a namespace that you have not qualified in swpcards.cpp
3. card is not declared properly in card.h - can you post your card.h file?
Actually, I got it.

Thanks to both of you!
Topic archived. No new replies allowed.