Getting Started with SystemC

SystemC is a set of C++ libraries, which enables a designer to perform cuncurrent simulation of system level model. It is used for Electronic System Level design and Transaction Level Modelling(TLM). In this article we will discuss the setup of SystemC in an Ubuntu 12.04 Machine and executing our first Hello World! program.

1. Download SystemC source from Accellera website.

2. Untar the package using tar -xzvf systemc-2.3.0.tgz

3. Change to the top level directory systemc-2.3.0 : cd systemc-2.3.0

4. Make a directory systemc230 for installation in your /usr/local/ path.

sudo mkdir /usr/local/systemc230

5. Create a directory for object code using mkdir objdir

6. Change directory to objdir using cd objdir

7. Run configure from your top level directory: ../configure --prefix=/usr/local/systemc230

8. Do make

9. Install by typing command: sudo make install

You are done with installation of SystemC 2.3.0. This version is packed with TLM package also. Now we can run our first Hello World! program.

Open your favourite text editor and enter the following program:

 // All systemc modules should include systemc.h header file
#include <systemc.h>
// Hello_world is module name
SC_MODULE (hello_world) {
SC_CTOR (hello_world) {
// Nothing in constructor
void say_hello() {
//Print "Hello World" to the console.
cout << "Hello World.\n";

// sc_main in top level function like in C++ main
int sc_main(int argc, char* argv[]) {
hello_world hello("HELLO");
// Print the hello world


Save the file as hello.cpp. Use following command to export a variable SYSTEMC_HOME.

export SYSTEMC_HOME=/usr/local/systemc230/

Now you can use following command to compile the program:

g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux -Wl,-rpath=$SYSTEMC_HOME/lib-linux -o hello hello.cpp -lsystemc -lm

Once the program is compiled type following to run your program


and you should get output

SystemC 2.3.0-ASI --- Aug 12 2012 09:27:22
Copyright (c) 1996-2012 by all Contributors,

Hello World.

If you get above output, you have successfully completed the setup and run your first SystemC program.

Note: This set of instruction has been tested with Linux Mint 14 which is derivative of Ubuntu Linux. In Ubuntu 12.10, user might need to install g++ before going through these steps.

  • nikilla

    i am getting fatal error as systemc.h:No such file or directory
    Compilation terminated

    • Sanju

      Is this error appearing while compiling SystemC or your program?

  • nikilla

    can you plz help me to rectify the error

    Thank you

  • nikilla

    I am getting the error while compiling the code given in examples (i.e) in systemc-2.2.0-examples….
    Commands used are..
    cd —installation path of systemc till simple_fifo
    make check….
    after this i am getting as systemc.h file not found..
    Help me out..

    • Nathanael

      please please please !!!!

      when you make a copy paste do it well !!!

      when you are to the step 5 before running the configuration, you have to do:

      mkdir objdir
      cd objdir

      after you have to configure:
      ../configure –prefix=/usr/local/systemc230

      and now you can do the rest.

      ps the command make have to be run in objdir directory

  • Sanju

    I am not sure about 2.2.0.
    Have you added the systemC installation path in include directories while compiling?

    -I. -I$SYSTEMC_HOME/include

    option can add the include path where -I. -I$SYSTEMC_HOME should point to your SystemC installation directory. Try additing proper command options. It will be helpful you could post your compilation command here.

  • Chi


    While I am trying to compile your hello example, the follow error shows:

    /usr/bin/ld: cannot find -lsystemc
    collect2: ld returned 1 exit status
    Anhy idea?

    • Sanju

      Did you define


      ? If yes, is it pointing to the correct path?

    • Chutikan Noikanchana

      you should change lib-linux to lib-linux64

      for run main.cpp
      g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux64 -Wl,-rpath=$SYSTEMC_HOME/lib-linux64 -o main main.cpp -lsystemc -lm

      • Abhyuday Sreenath

        It worked for me when I changed lib-linux to lib-linux64. To run hello.cpp:

        g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux64
        -Wl,-rpath=$SYSTEMC_HOME/lib-linux64 -o hello hello.cpp -lsystemc -lm

      • Prachi Sahu

        Thanks it really helped 🙂

    • Prachi Sahu

      Did you solved your problem I am also getting problem even after changing lib-linux64

  • bhargv

    any one please help me on this.
    when i execute step 5 i got this error.
    “bash: ../configure: No such file or directory”
    & if just use ../configure then at a time of compilion it gives error
    “fatal error as systemc.h:No such file or directory”

    • skjoshi

      The article has been updated. Please follow it now and let me know if problem persists.

  • Hi All,

    Sorry for creating confusions. There were some mistakes in the article. Article has been updated now.

    Thanks Nathanael for pointing out.

  • Paul Ehrlich

    Thanks worked even for Ubuntu 13.04.

    Two thinks a had to to additionally

    1)sudo apt-get install g++ (wasn’t somehow not on my system, maybe 13.04 standard?)

    2) export LD_LIBRARY_PATH=/usr/local/systemc-2.3.0/lib-linux64:$LD_LIBRARY_PATH

    oterwise my SystemC example wouldn’t start and stop with the followin error

    ./example.o: error while loading shared libraries:
    cannot open shared object file: No such file or directory

    • Yes Paul.


      is not installed by defult in Ubuntu 12.10 too.

      I was not aware of LD_LIBRARY_PATH issue. I will test it and update the article accordingly. Thanks a lot for updating.

  • MeatBoy

    Hi !

    Thanks for this helpful tutorial which still stands three years after.
    Here are just a few observations (stands for Kubuntu 16.04 64bits):
    – In the compilation command line, lib-linux must be replaced by lib-linux64 if on a 64bits OS
    – As Paul said, the LD_LIBRARY_PATH must be updated on ubuntu to tell that there is an unusual path to dynamic libraries.
    export LD_LIBRARY_PATH=/usr/local/systemc231/lib-linux64:$LD_LIBRARY_PATH
    do the trick (lib-linux instead of lib-linux64 if 32bits)

  • nic30

    Hi All,
    why systemc is not installed as regular library ?
    I mean why include files are not in

    /usr/local/include or /usr/include etc.
    Why is good to use SYSTEMC_HOME and -I,-L everytime?

    • I think you can do it. However, it might be done to avoid conflict with any file with same name in that path. Further, this approach allows you to use different versions of SystemC by specifying the -I,-L options.

  • prasenjit dey

    While compiling with the following command “g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux -Wl,-rpath=$SYSTEMC_HOME/lib-linux -o hello hello.cpp -lsystemc -lm”
    I got the error “cannot find -lsystemc”.
    Please help