Hi,
The problem is solved by literally adding a new parameter `sim_objects`.
> SimObject("HelloObject.py", sim_objects = ["HelloObject"])
But I find yet another problem with the tutorial: the code that use
classes from gem5 is missing namespace declaration. For example, the
class `SimObject` is under namespace `gem5`, but the tutorial is using
it directly. It makes the compiler unable to find the class.
```
#ifndef __LEARNING_GEM5_HELLO_OBJECT_HH__
#define __LEARNING_GEM5_HELLO_OBJECT_HH__
#include "params/HelloObject.hh"
#include "sim/sim_object.hh"
class HelloObject : public SimObject
{
public:
HelloObject(const HelloObjectParams &p);
};
#endif // __LEARNING_GEM5_HELLO_OBJECT_HH__
```
For the compiler to work, we should use `gem5::SimObject` instead. And
`gem5::HelloObjectParams` for the same reason.
None of the problems are mentioned in the tutorial. I wonder if it is
necessary to *update* the tutorial?
Artyom
artyom...@hust.edu.cn
On 3/27/22 10:05, Artyom Liu wrote:
Hi,
I'm new to gem5 and just start learning by following the tutorial on
gem5.org. However, there's a problem when I try to create my custom
object[1].
[1]: https://www.gem5.org/documentation/learning_gem5/part2/helloobject/
I follow exactly the guide, but I fail to re-compile with scons. The
error message as below.
> Error: SimObject(HelloObject.py...) must list c++ sim_objects or
enums > (set either to [] if there are none).
My gem5 version is Version 21.2.1.0, and I noticed that there's an *API
change* about SimObject declaration in Version 21.2.0.0, requiring that
sim_object parameter of SimObject declaration "should list all SimObject
classes which have a type attribute defined".
It matches the error message. So I wonder how could I change my
SConscript to fit this change? My current SConscript is from the tutorial.
```
Import("*")
SimObject("HelloObject.py")
Source("hello_object.py")
```
Artyom
artyom...@hust.edu.cn
_______________________________________________
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