Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Problem z linkowaniem

Ostatnio zmodyfikowano 2012-05-28 18:38
Autor Wiadomość
Virpi
Temat założony przez niniejszego użytkownika
Problem z linkowaniem
» 2012-05-21 23:13:37
Może zacznęod kodu programu, a chyba muszę wkleić wszystkie pliki *.h żeby było widać o co chodzi:

C/C++
#ifndef CAKWARIUM_H
#define CAKWARIUM_H

#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>

#include "CElement_gry.h"
#include "CElement_zywy.h"
#include "CElement_ruchomy.h"
#include "CSlimak.h"
#include "CKamien.h"
#include "CWodorost.h"
#include "CRybka.h"
#include "CKarma.h"
#include <SFML/Graphics.hpp>


class CAkwarium
{
public:
    CAkwarium();
    virtual ~CAkwarium();
    void ch_water_lvl( sf::Event key );
    int r_water_lvl();
    void add_item( sf::Event key );
    void delete_item( int i );
    void play( sf::Event action, const sf::Input & wejscie, CAkwarium * );
    Tstruct find_seaweed( int x, int y, int z );
    Tstruct find_food( int x, int y, int z );
    CElement_gry * wsk;
    std::vector < CElement_gry *> obj_list;
   
protected:
   
private:
    int water_lvl;
   
};

#endif // CAKWARIUM_H

#ifndef CELEMENT_GRY_H
#define CELEMENT_GRY_H

#include <SFML/Graphics.hpp>

struct Tstruct
{
    int x, y, z;
};

class CElement_gry
{
public:
    CElement_gry();
    virtual ~CElement_gry();
    Tstruct read_poz();
    Tstruct read_hitbox();
   
protected:
    Tstruct poz, hitbox;
   
private:
   
};

#endif // CELEMENT_GRY_H

#ifndef CSLIMAK_H
#define CSLIMAK_H

//#include "CAkwarium.h"
#include "CElement_zywy.h"
#include "CElement_ruchomy.h"
//#include "CWodorost.h"

class CAkwarium;


class CSlimak
    : public CElement_ruchomy
    , public CElement_zywy
{
public:
    CSlimak( int );
    virtual ~CSlimak();
    void move( sf::Event key, CAkwarium *, int water_lvl );
    void eat_food( CAkwarium *& );
   
protected:
   
private:
    void move_manual( sf::Event key, int water_lvl );
   
};

#endif // CSLIMAK_H

#ifndef CKAMIEN_H
#define CKAMIEN_H

#include "CAkwarium.h"
#include "CElement_zywy.h"

class CAkwarium;

class CKamien
    : public CElement_gry
{
public:
    CKamien();
    virtual ~CKamien();
    void destroy_alive( CAkwarium * & m_akw );
   
protected:
   
private:
};

#endif // CKAMIEN_H

#ifndef CELEMENT_ZYWY_H
#define CELEMENT_ZYWY_H

//#include "CElement_gry.h"


class CElement_zywy
{
public:
    CElement_zywy();
    virtual ~CElement_zywy();
    void grow();
    void make_older();
   
protected:
    int age;
   
private:
};

#endif // CELEMENT_ZYWY_H

#ifndef CWODOROST_H
#define CWODOROST_H

#include "CElement_gry.h"
#include "CElement_zywy.h"


class CWodorost
    : public CElement_gry
    , public CElement_zywy
{
public:
    CWodorost();
    virtual ~CWodorost();
    void bite();
   
protected:
   
private:
};

#endif // CWODOROST_H

#ifndef CRYBKA_H
#define CRYBKA_H

#include "CElement_ruchomy.h"
#include "CElement_zywy.h"
#include "CAkwarium.h"


class CRybka
    : public CElement_ruchomy
    , public CElement_zywy
{
public:
    CRybka( int water_lvl );
    virtual ~CRybka();
    void move( sf::Event key, CAkwarium *, int water_lvl );
    void eat_food( CAkwarium *& );
   
protected:
   
private:
    void move_manual( sf::Event key, int water_lvl );
};

#endif // CRYBKA_H

#ifndef CKARMA_H
#define CKARMA_H

#include "CElement_gry.h"
#include "CAkwarium.h"

class CAkwarium;


class CKarma
    : public CElement_gry
{
public:
    CKarma( int );
    virtual ~CKarma();
    void eat( CAkwarium *&, int );
protected:
private:
};

#endif // CKARMA_H

#ifndef CELEMENT_RUCHOMY_H
#define CELEMENT_RUCHOMY_H

//#include "CElement_gry.h"
//#include "CKamien.h"
#include "CAkwarium.h"
#include <SFML/Graphics.hpp>

class CAkwarium;


class CElement_ruchomy
    : public CElement_gry
{
public:
    CElement_ruchomy();
    virtual ~CElement_ruchomy();
    virtual void move( sf::Event key, CAkwarium *, int water_lvl ) = 0;
    virtual void eat_food( CAkwarium *& ) = 0;
    void change_active( const sf::Input & wejscie );
    void change_speed();
    void stop( CAkwarium * );
    void make_hungry();
    void die();
    void move_auto( Tstruct );
   
protected:
    bool active;
    bool hungry;
    int speed;
    Tstruct action;
   
   
   
private:
    virtual void move_manual( sf::Event key, int water_lvl ) = 0;
   
   
};

#endif // CELEMENT_RUCHOMY_H

Mianowicie po dodaniu funkcji
void stop( CAkwarium * );
 w klasie CElement_ruchomy otrzymuję błędy:

error: expected class-name before ',' token w plikach CSlimak i CRybka. Nie rozpoznaje mi tam klasy CElement_ruchomy. Nie pojmuję dlaczego. Może gdzieś przesadziłem z liczbą dołączanych plików nagłówkowych? Ale zmieniałem je na wiele sposobów i nie udało mi się tego skompilować ;/
P-57140
kubawal
» 2012-05-28 17:11:55
Masz za dużo nagłówków i się w nich gubisz.Wsadź klasy jednego rodzaju do jednych plików nagłówkowych
P-57397
DejaVu
» 2012-05-28 18:38:24
W plikach:
  • CSlimak.h
  • CRybka.h
dołącz plik:
C/C++
#include "CElement_ruchomy.h"
P-57401
« 1 »
  Strona 1 z 1