I have a c++ class TrisState:
#ifndef TRISSTATE_H
#define TRISSTATE_H
#include <QObject>
#define WIDTH 3
#define HEIGHT 3
{
Q_OBJECT
Q_ENUMS(GameState)
public:
explicit TrisState
(QObject *parent
= 0);
GameState x();
enum GameState {
Player1 = 'X',
Player2 = 'O',
Draw = '-',
Void = ' '
};
private:
GameState board[WIDTH][HEIGHT];
signals:
public slots:
};
#endif // TRISSTATE_H
#ifndef TRISSTATE_H
#define TRISSTATE_H
#include <QObject>
#define WIDTH 3
#define HEIGHT 3
class TrisState : public QObject
{
Q_OBJECT
Q_ENUMS(GameState)
public:
explicit TrisState(QObject *parent = 0);
GameState x();
enum GameState {
Player1 = 'X',
Player2 = 'O',
Draw = '-',
Void = ' '
};
private:
GameState board[WIDTH][HEIGHT];
signals:
public slots:
};
#endif // TRISSTATE_H
To copy to clipboard, switch view to plain text mode
and
#include "trisstate.h"
TrisState::GameState TrisState::x()
{
}
#include "trisstate.h"
TrisState::GameState TrisState::x()
{
}
To copy to clipboard, switch view to plain text mode
When i compile the code i've two errors:
trisstate.h:13: error: 'GameState' does not name a type
GameState x();
^
and
trisstate.cpp:4: error: no 'TrisState::GameState TrisState::x()' member function declared in class 'TrisState'
TrisState::GameState TrisState::x()
^
What am i wrong?
Bookmarks