Skip to main content
gamedev.net
🔒 Locked

base class undefined error

Started by TinyGameDev 4 replies 1.3k views
Original Post
TinyGameDev
TinyGameDev
So I have a structure like this: //file1.h class a { ... } //file2.h #include "file1.h" class b : public a { .. } so everything works fine. BUT, when I introduce another class like this: //file3.h #include "file2.h" class c { ... } things get ugly and I get the compilation error: "error C2504: 'a' : base class undefined". Notice the 'a', wher the error is. What could be the problem? When I comment the line #include "file2.h" everything is fine again...
Hodgman
Hodgman
are you using any include guard techniques (e.g. #ifndef/#define/#endif method) that could have an error in it?

Also, what line does the error appear on?
rockdeity
rockdeity
semicolons after the curly braces for class definitions for starters
TinyGameDev
TinyGameDev
ah sorry, i do use semicolon.
and also I use #pragma once at the top of every header
JohnBolton
JohnBolton
There has to be more going on than what you have shown us since there is nothing wrong with the little bit of code you have provided. Is class a inside a namespace perhaps?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
MaulingMonkey
MaulingMonkey
Let's see some real code instead of playing 20 questions, please.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.