I am new in systemc. There is one confusion that I am having.
I am creating a sc_module(hello_world)
. The sc_ctor(hello_world)
has nothing between the curly braces and I just have a simple void say_hello()
function inside the module which prints "hello world."
In the sc_main
, I did this:
hello_world hello;
hello.say_hello();
However, I am getting an error that error C2228: left of '.say_hello' must have class/struct/union.
I tried this and it worked:
in sc_main
, I did this:
hello_world hello("hi ");
hello.say_hello();
Why it is showing error in the first place? I didn't use one argument constructor.
So, instead of hello_world hello("hi ")
shouldn't it be hello_world hello
? I was just trying to compare with C++ class.
It is possible that you defined your constructor as private. As a result compiler cannot name it from main.cpp.