Jump to content

Visual Studio 10 and systemc 2.3.0


Recommended Posts

Hello everyone,


I’m new in systemc and in this forum.


I successfully downloaded and installed systemc-2.3.0 on MSVC-2010 (Windows 7)


I can compile and run the examples.

BUT when I write an own program it doesn’t work.

For example I wrote this simple program.


#include "systemc.h"#define WIDTH  4
SC_MODULE(adder) {
   sc_in<sc_uint<WIDTH> > a, b;     sc_out<sc_uint<WIDTH> > sum;
  void do_add() {      sum.write(a.read() + b.read())  }
  SC_CTOR(adder)       {    SC_METHOD(do_add);       sensitive << a << b;  }


systemc.lib(sc_main_main.obj) : error LNK2019: unresolved external symbol
> _sc_main referenced in function _sc_elab_and_sim
> Debug/addieren.exe : fatal error LNK1120: 1 unresolved externals

It seems that the compiler can’t find systemc.lib, but I have add additional libraries in the properties and set the environment variable.

I checked it many times but I always got the above-mentioned messages.


Can you help me?


Thanks in advance.





Uni Bochum

Link to comment
Share on other sites



The problem is not that the linker cannot find the systemc.lib. It searches for an implementation of 'sc_main'.


Each SystemC-Modell has to provide a function sc_main(int,char*[]). In some commercial simulator tools this can be replaced by an explicit top module. But with the accellera simulator you need to implement the function. 

In the sc_main function you instantiate your top level module and/or connect it to a testbench. And you call sc_start here to start the simulation.


int sc_main(int argc,char*[] argv)
  Top top("top");
  return 0;




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...