Installation & Setup
How to download, compile, and link the Accellera SystemC library on Linux and Windows.
Downloading and Installing SystemC
Since SystemC is a C++ library, you do not install an "executable" or an "IDE". You must download the source code, compile it into a static library (.a or .lib), and then link your own C++ code against it.
The official reference implementation is maintained by the Accellera Systems Initiative.
Step 1: Download the Source Code
- Go to the Accellera Systems Initiative Download Page.
- Download the latest SystemC Core source code (e.g., SystemC 2.3.3 or 2.3.4).
- Extract the
.tar.gzor.zipfile to a permanent directory on your machine (e.g.,/opt/systemcon Linux orC:\systemcon Windows).
Step 2: Compiling the Library
On Linux / macOS (Using CMake & GCC/Clang)
Modern SystemC provides a CMakeLists.txt making installation vastly easier than the old autotools method.
- Open your terminal and navigate to the extracted SystemC directory:
cd /path/to/systemc-2.3.3 - Create a build directory and run CMake:
mkdir build && cd build cmake .. -DCMAKE_CXX_STANDARD=14 - Compile and install (this usually installs to
/usr/local/systemcby default, or the path specified viaCMAKE_INSTALL_PREFIX):make -j4 sudo make install
On Windows (Using Visual Studio)
- Open the extracted folder and navigate to the
msvc10ormsvc14directory (depending on your Visual Studio version). - Open the
SystemC.slnsolution file in Visual Studio. - Select your desired configuration at the top: Debug or Release, and x64.
- Right-click the
SystemCproject in the Solution Explorer and click Build. - Once finished, the compiled
.libfiles will be located in theDebugorReleasefolder within the MSVC directory.
Step 3: Compiling Your First Program
Once the library is built, you can write a main.cpp file:
#include <systemc.h>
int sc_main(int argc, char* argv[]) {
std::cout << "Hello, SystemC World!" << std::endl;
return 0;
}Compiling on Linux (g++)
You must tell the compiler where the SystemC headers (-I) and library files (-L) are located, and explicitly link the systemc library (-lsystemc).
g++ main.cpp -o hello_systemc \
-I/usr/local/systemc/include \
-L/usr/local/systemc/lib-linux64 \
-lsystemc -lmCompiling on Windows (Visual Studio)
In your own project properties:
- C/C++ -> General -> Additional Include Directories: Add
C:\systemc\src. - C/C++ -> Preprocessor -> Preprocessor Definitions: Add
_CRT_SECURE_NO_WARNINGS. - Linker -> General -> Additional Library Directories: Add
C:\systemc\msvc14\SystemC\x64\Release. - Linker -> Input -> Additional Dependencies: Add
SystemC.lib.
Using CMake (Recommended)
Instead of typing out GCC flags or clicking through Visual Studio menus, the industry standard is to use CMake to build your projects. You can write a CMakeLists.txt based on the example in the previous step and use it for any future tutorials.
Comments and Corrections