SystemC学习(一)——环境安装

一、环境安装

cd systemc-2.3.4/
mkdir build && cd build
../configure --prefix=/home/systemc-2.3.4

如果最后的configure指令出现报错config.status: error: cannot find input file: `src/Makefile.in’,返回systemc-2.3.4/目录下,执行如下命令再返回build目录下。

cd ..
sudo apt-get install automake
aclocal
automake --add-missing
cd build

sudo make -j $(nproc)
make install
  • bashrc修改
sudo vi ~/.bashrc

#写入如下内容
export SYSTEMC_HOME=/home/systemc-2.3.4/
export LD_LIBRARY_PATH=/home/systemc-2.3.4/lib-linux64/:$LD_LIBRARY_PATH
 
source ~/.bashrc

二、Hello World运行

  • touch helloworld.cpp
#ifndef _HELLO_H
#define _HELLO_H
#include "systemc.h"
SC_MODULE(hello)
{
    SC_CTOR(hello)
    {
        cout<<"Hello, SystemC!"<<endl;
    }
};
#endif
 
//main.cpp
int sc_main(int i, char* a[])
{
    hello h("hello");
    return 0;
}
  • compile
g++ helloworld.cpp -I/home/systemc/include/ -L/home/systemc/lib-linux64 -o hello -lsystemc

报错:

error while loading shared libraries: libsystemc-2.3.4.so: cannot open shared object file: No such file or directory

执行以下命令:

// 建立软链接
ln -s /home/systemc-2.3.4/lib-linux64/libsystemc-2.3.4.so /usr/lib/libsystemc-2.3.4.so

// 更新缓存
sudo ldconfig 
  • 执行
./hello

三、参考文献

  • Linux安装:

SystemC入门学习Demo用例的工程化配置_一个systemcdemo-CSDN博客

ubuntu系统安装systemc-2.3.4流程_systemc requires a c++ compiler version of at leas-CSDN博客

SystemC (accellera.org)

  • Windows安装

Windows VS2022 下配置SystemC环境 - 知乎 (zhihu.com)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

-特立独行的猪-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值