You have a circular dependency in your include files system.hh gets past
the compiler guard, then includes base.hh which includes cache.hh which
tries to include system.hh. Since system.hh has already started to be
included it gets skipped, but since it was only started none of the things
it defines are available yet. You can break these sorts of loops by being
careful to only include things you actually need, by declaring classes
without actually including their definitions, and by moving the use of
classes (and including their header files) into .cc files which won't be
part of a loop.

Gabe

On Thu, Feb 25, 2021 at 12:40 AM yangyuqing--- via gem5-users <
gem5-users@gem5.org> wrote:

> I use gem5 20 on ubuntu 20.04.
> I try to add some new features to gem5, but I do not damage class system.
> When I run scons, errors occurs like following:
> In file included from /usr/include/c++/9/cassert:44,
>                  from build/X86/mem/cache/write_queue_entry.hh:49,
>                  from build/X86/mem/cache/write_queue.hh:50,
>                  from build/X86/mem/cache/base.hh:64,
>                  from build/X86/mem/cache/cache.hh:53,
>                  from build/X86/cpu/base.hh:65,
>                  from build/X86/sim/system.hh:55,
>                  from build/X86/arch/x86/fs_workload.cc:48:
> build/X86/mem/cache/base.hh: In member function 'void
> BaseCache::incMissCount(PacketPtr)':
> build/X86/mem/cache/base.hh:1224:48: error: invalid use of incomplete type
> 'class System'
>  1224 |         assert(pkt->req->requestorId() < system->maxRequestors());
>       |                                                ^~
> In file included from build/X86/cpu/thread_context.hh:54,
>                  from build/X86/arch/x86/fs_workload.hh:47,
>                  from build/X86/arch/x86/fs_workload.cc:39:
> build/X86/cpu/pc_event.hh:39:7: note: forward declaration of 'class System'
>    39 | class System;
>       |       ^~~~~~
> In file included from /usr/include/c++/9/cassert:44,
>                  from build/X86/mem/cache/write_queue_entry.hh:49,
>                  from build/X86/mem/cache/write_queue.hh:50,
>                  from build/X86/mem/cache/base.hh:64,
>                  from build/X86/mem/cache/cache.hh:53,
>                  from build/X86/cpu/base.hh:65,
>                  from build/X86/sim/system.hh:55,
>                  from build/X86/arch/x86/fs_workload.cc:48:
> build/X86/mem/cache/base.hh: In member function 'void
> BaseCache::incHitCount(PacketPtr)':
> build/X86/mem/cache/base.hh:1235:48: error: invalid use of incomplete type
> 'class System'
>  1235 |         assert(pkt->req->requestorId() < system->maxRequestors());
>       |                                                ^~
> In file included from build/X86/cpu/thread_context.hh:54,
>                  from build/X86/arch/x86/fs_workload.hh:47,
>                  from build/X86/arch/x86/fs_workload.cc:39:
> build/X86/cpu/pc_event.hh:39:7: note: forward declaration of 'class System'
>    39 | class System;
>       |       ^~~~~~
>  [     CXX] X86/arch/x86/insts/static_inst.cc -> .o
> scons: *** [build/X86/arch/x86/fs_workload.o] Error 1
> scons: building terminated because of errors.
>
> I do not know what is wrong?
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to