0

While compile the below code got compilation error as

rise.h: error: pointer to incomplete class type is not allowed (fall->value = id)

While I added the function definition in dot cpp file, got linking error.

Note: Its working fine without inline.

File: fall.h

#include<rise.h>
class Fall
{
    public:
    char value;
};

File: rise.h

#include<fall.h>

class Fall;

class Rise
{
    public:
    Fall *fall;

    inline void fill_the_val(struct ring *buf, char flag=false, char id = 0)
    {
        if(true == flag)
        {
            fall->value = id; //this line got compilation issue
        }
    }
};

File: rise.cpp

#include<fall.h>

#include<rise.h>
int main()
{
   fill_the_val(buf, true, 1);
}
James Z
  • 12,209
  • 10
  • 24
  • 44
codeflow
  • 13
  • 3

0 Answers0