Namespaces were recently added to gem5 and the documentation hasn't been updated, yet. We'll put that on the to do list.
Cheers, Jason On Wed, Feb 2, 2022 at 6:11 AM Zhang Zhiyuan via gem5-users < gem5-users@gem5.org> wrote: > Dear gem5 faculties: > > Hi! I’ve been trying to follow the getting started guide on the gem5 > website, and encountered this question in “Creating a very simple > SimObject” part of the tutorial. I removed the files under > src/learning_gem5/part2, and substituted them with the following files, > content of which are precisely copied down from the tutorial: > > However, when I tried to recompile the gem5.opt, the following error was > shown: > > > > In file included from build/X86/learning_gem5/part_new/hello_object.cc:2: > > build/X86/learning_gem5/part_new/hello_object.hh:8:1: error: expected > class-name before '{' token > > 8 | { > > | ^ > > build/X86/learning_gem5/part_new/hello_object.hh:10:27: error: > 'HelloObjectParams' does not name a type; did you mean 'HelloObject'? > > 10 | HelloObject(const HelloObjectParams &p); > > | ^~~~~~~~~~~~~~~~~ > > | HelloObject > > build/X86/learning_gem5/part_new/hello_object.cc:6:32: error: > 'HelloObjectParams' does not name a type; did you mean 'HelloObject'? > > 6 | HelloObject::HelloObject(const HelloObjectParams &p) : SimObject(p) > > | ^~~~~~~~~~~~~~~~~ > > | HelloObject > > build/X86/learning_gem5/part_new/hello_object.cc: In constructor > 'HelloObject::HelloObject(const int&)': > > build/X86/learning_gem5/part_new/hello_object.cc:6:56: error: class > 'HelloObject' does not have any field named 'SimObject' > > 6 | HelloObject::HelloObject(const HelloObjectParams &p) : SimObject(p) > > | ^~~~~~~~~ > > [SO Param] m5.objects.Ethernet, EtherLink -> X86/params/EtherLink.hh > > [SO Param] m5.objects.Ethernet, DistEtherLink -> > X86/params/DistEtherLink.hh > > [SO Param] m5.objects.Ethernet, Sinic -> X86/params/Sinic.hh > > [SO Param] m5.objects.FuncUnit, FUDesc -> X86/params/FUDesc.hh > > [SO Param] m5.objects.InstPBTrace, InstPBTrace -> X86/params/InstPBTrace.hh > > scons: *** [build/X86/learning_gem5/part_new/hello_object.o] Error 1 > > scons: building terminated because of errors. > > > > It seems that the HelloObject sources cant find HelloObjectParams and > SimObject definitions. However, after throwing everything in the header and > the source file under namespace gem5, and adding cxx_class member in the > python class definition, everything seems to work out fine. So is it an > issue that needs to be fixed in the tutorial, or is the namespace inclusion > unnecessary here? Thanks! > > > > Zhiyuan Zhang > > > > 2022.2.2 > _______________________________________________ > 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