glad to join the forums. I'm apart of cplusplus.com but I haven't been getting much help there with this issue, so I was hoping maybe things would be different here. I'm a bit new to c++, but I'm getting alright with the basics. I've decided to take on a rather large project of creating a library for console rpg creation. I'm having a bit of trouble with my code though. Being new to c++ I'm having a bit of trouble in creating namespaces with classes in them properly.
Header file sample
namespace OgreWeaponStrikes
{
// Following class deals with swrod strikes
class OgreSwordStrikes()
{
//The following method deals with random sword strikes based on OgreSwordStrikeID 1 for light damage, 2 for critical.
//Enemy string passes in the name of the enemy, and DamageAmount passes in the amount of damage done.
public:
OgreRanSwordStrikes(int OgreSwordStrikesID, int DamageAmount, string EnemyString);
};
CPP file sample
using namespace std;
OgreWeaponStrikes::OgreSwordStrikes::OgreRanSwordStrikes(int OgreSwordStrikesID, int DamageAmount, string EnemyString)
{
switch(OgreSwordStrikesID)
{
// The first ID deals with 1 imput for light sword strikes.
case 1:
srand(time(0);
int RandomIndexID = (rand()%20)+1;
errors in header file
expected unqualified-id before ')' token|
forward declaration of 'struct OgreWeaponStrikes::OgreSwordStrikes'|[/quote]
errors in CPP file
error: ISO C++ forbids declaration of 'OgreRanSwordStrikes' with no type|
error: invalid use of incomplete type 'struct OgreWeaponStrikes::OgreSwordStrikes'|[/quote]
could someone point out what's causing them, and give a brief description?
thanks,
JB.