error: expected identifier before 'public'

536 Views Asked by At

I'm currently trying to make a GBA game for the GBA Game Jam, anyways I've gotten rid of basically every error when trying to compile I think these last errors are connected to each other though so anyways here's the error that I think there all connected to:

error: expected identifier before 'public'
   38 | class gbaEngine :: public engine

Here are the rest of the errors:

error: expected unqualified-id before 'public'
error: cannot call member function 'virtual bool gbaEngine::OnUserCreate()' without object
  190 |     gbaEngine::OnUserCreate();
cannot call member function 'void gbaEngine::Start()' without object
  189 |     gbaEngine::Start();
error: cannot call member function 'virtual bool gbaEngine::OnUserCreate()' without object
  190 |     gbaEngine::OnUserCreate();

Anyways here are the parts of the script you would probably need to see (although if you think it might be somewhere else feel free to ask about it):

engine.cpp:

#include "GBA3D/engine.h"
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <thread>
#include <fstream>
#include <strstream>
#include <algorithm>
#include <string>
#include "toolbox.h"

struct vec3d
{
    float x, y, z;
};

struct triangle
{
    vec3d p[3];
};

struct mesh
{
    std::vector<triangle> tris;
};

struct mat4x4
{
    float m[4][4] = { 0 };
};

class gbaEngine :: public engine
{
public:
    //Stuff in here
};

engine.h:

#ifndef ENGINE_H
#define ENGINE_H

#include <stdio.h>
#include <math.h>
#include <fstream>
#include <iostream>
#include <strstream>
#include <algorithm>
#include <vector>
#include <string>
#include <thread>
#include "toolbox.h"

//#define REG_TM2D -0x4000                        //0x4000 ticks till overflow
//#define REG_TM2CNT TM_FREQ_1024                 //we're using the 1024 cycle timer
//#define REG_TM3CNT TM_ENABLE | TM_CASCADE

//typedef uint32_t u32;
//typedef int32_t  s32;

bool m_bAtomActive;


class gbaEngine
{
public:
    //Stuff in here
};

#endif

If you can help please do

Thanks in advance

1

There are 1 best solutions below

3
On BEST ANSWER

It should be the following:

class B : class A

This will make class B inherit class A.

You have:

class gbaEngine :: public engine

instead of:

class gbaEngine : public engine