Jump to content

System C quite different from c++

Ganesan R

Recommended Posts

I have sc_module class fifog. What I want is an array of fifog in the fashion fifog[0],fifog[1] etc.

fifog fifogarray[2]={fifog("fifog231"),fifog("fifog232")} declare in sc_main will surely work in c++, but in system c it throws up an error
1> error C2248: 'sc_core::sc_module::sc_module' : cannot access private member declared in class 'sc_core::sc_module' even though I have all member functions and elements declared as public in fifog.

If that line is commented the program quite compiles and runs.

Why so?

You can check this in attached file.

Trying how to access data members of fifog[0], fifog[1] etc. in sc_main.

Any help will be deeply appreciated.





Link to comment
Share on other sites

First, the title of this post is completely nonsensical. SystemC is a library written in C++ and everything about it is C++. It is much more likely that you simply are not very proficient with C++. One aspect of SystemC I always warn newbies about is that SystemC uses pretty much all of the features of C++. You really cannot get by with just thinking C++ is merely a better C. You have to really know about polymorphism, function/operator overloading, templates, exception handling, STL libraries, and all things C++. If you do not, I suggest you get some deeper learning on C++.

Your problem is that sc_module disallows copy construction. Prior to C++11, this was accomplished by declaring the copy constructor private, which is why you are getting the error.

sc_vector really is a better way of creating an array of modules, and it looks as if somebody has given you this hint.


Link to comment
Share on other sites

Thank you Sir.

I finally got array of fifo objects after lot of efforts using SC_vector

I apologize for the title of the post, but I meant only what worked for c++ was not working for system c in that particular line. Again sorry.

The problem with beginners like me is that if something is not working we don't know what would have gone wrong. A lot of book reading is of little assistance in tracing out the error in  debugging the error.

This is where expert help is of timely assistance like Eyck comment yesterday.

Again lot of thanks for all of you as I am getting past my major hurdle.

Will keep posting any further problems I face in my design.


R. Ganesan







Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...