M
Martin Eisenberg
Hi!
I have a header with two classes, WidthLogger and Hyst. WidthLogger
is declared first; its ctor takes a Hyst reference. Hyst declares
WidthLogger a friend. Hyst constructs a WidthLogger member, giving
itself as parameter, and calls its log() method in various places.
WidthLogger::log() then uses the reference to note down the values of
some Hyst members.
Except that I don't get that far because VC6 is bitchin', I hope
someone can explain why. Here is the complete beginning of said
header, just in case the actual problem is not where the first
message occurs:
#ifndef __hyst__
#define __hyst__
#include <cmath>
#include <mCmath.h>
//-------
// see Hyst: tick(), setWidth()
#define DEBUG_SHAPE
//#define DEBUG_STAGES
//------------------------------------------------
#define MAX_STAGES 6
#define MAX_SLEW 0.98f
#define NUM_SHAPES 2
#define SHAPE1_DEGREE 3
#define SHAPE1_MAX_WIDTH 0.6f
#define EPSILON 0.000000001f // ~ 2^-30
//------------------------------------------------
#ifdef DEBUG_SHAPE
#include <fstream>
class Hyst;
class WidthLogger {
public:
WidthLogger(const Hyst& h)
: h_(h), f_("width.log"), prevWidth_(-1.f), entries_(0)
{}
void log(void)
{
if(h_.width_ ...
(end of excerpt)
On the last line, the compiler gives:
hyst5.h(49) : error C2027: use of undefined type 'Hyst'
hyst5.h(34) : see declaration of 'Hyst'
I figured I might not need to declare Hyst, since its definition
immediately follows WidthLogger. But commenting out the declaration
produced
hyst5.h(38) : error C2629: unexpected 'class WidthLogger ('
which I understand even less, since the incriminating character
sequence does not occur anywhere! Of course, the follow-on errors
aren't illuminating either. Again, I'd be most thankful if anyone
could make the issue clear to me.
Martin
I have a header with two classes, WidthLogger and Hyst. WidthLogger
is declared first; its ctor takes a Hyst reference. Hyst declares
WidthLogger a friend. Hyst constructs a WidthLogger member, giving
itself as parameter, and calls its log() method in various places.
WidthLogger::log() then uses the reference to note down the values of
some Hyst members.
Except that I don't get that far because VC6 is bitchin', I hope
someone can explain why. Here is the complete beginning of said
header, just in case the actual problem is not where the first
message occurs:
#ifndef __hyst__
#define __hyst__
#include <cmath>
#include <mCmath.h>
//-------
// see Hyst: tick(), setWidth()
#define DEBUG_SHAPE
//#define DEBUG_STAGES
//------------------------------------------------
#define MAX_STAGES 6
#define MAX_SLEW 0.98f
#define NUM_SHAPES 2
#define SHAPE1_DEGREE 3
#define SHAPE1_MAX_WIDTH 0.6f
#define EPSILON 0.000000001f // ~ 2^-30
//------------------------------------------------
#ifdef DEBUG_SHAPE
#include <fstream>
class Hyst;
class WidthLogger {
public:
WidthLogger(const Hyst& h)
: h_(h), f_("width.log"), prevWidth_(-1.f), entries_(0)
{}
void log(void)
{
if(h_.width_ ...
(end of excerpt)
On the last line, the compiler gives:
hyst5.h(49) : error C2027: use of undefined type 'Hyst'
hyst5.h(34) : see declaration of 'Hyst'
I figured I might not need to declare Hyst, since its definition
immediately follows WidthLogger. But commenting out the declaration
produced
hyst5.h(38) : error C2629: unexpected 'class WidthLogger ('
which I understand even less, since the incriminating character
sequence does not occur anywhere! Of course, the follow-on errors
aren't illuminating either. Again, I'd be most thankful if anyone
could make the issue clear to me.
Martin