目录
  1. 1. systemC的环境搭建
    1. 1.0.1. windows下systemC的环境搭建
      1. 1.0.1.0.1. 编译SystemC库
      2. 1.0.1.0.2. 新建win32控制台应用程序,测试代码如下
      3. 1.0.1.0.3. 报错:'sprintf':This function or variable may be unsafe
      4. 1.0.1.0.4. 报错:namespace "std" 没有成员 "gets" "gets": 不是 "std" 的成员 “gets”: 符号不能用在 using 声明中
systemC的环境搭建

systemC的环境搭建

windows下systemC的环境搭建

Visual Stdio版本:VS2019

编译SystemC库
  • 下载SystemC library source code (systemc-2.3.1版本)
  • 解压到工作目录
  • 打开…\systemc-2.3.0\msvc80\SystemC目录下的SystemC.sln
  • 直接”生成(Build英文)”–>“生成解决方案(Build Solution)”,如果编译成功的话(忽略那些Warning)。在…\systemc-2.3.0\msvc80\SystemC\debug目录下就生成了SystemC.lib
新建win32控制台应用程序,测试代码如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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
hello.say_hello();
return(0);
}

配置步骤

右击工程名->选择Properties

调试->环境(SC_SIGNAL_WRITE_CHECK=DISABLE

VC++目录->包含目录(…\systemc-2.3.0\src)

VC++目录->库目录(…\systemc-2.3.2\msvc10\SystemC\Debug)

C/C++ ->语言->启用运行时类型信息->是

C/C++->代码生成->运行库->多线程调试 (/MTd)

C/C++->命令行->其它选项(/vmg)

Linker ->常规->附加目录库 (..systemc-2.3.1/msvc10/SystemC/Debug)

链接器->输入->附加依赖项(SystemC.lib)

C/C++->所有选项->警告等级 ->等级1(/W1)

生成编译。

报错:'sprintf':This function or variable may be unsafe

解决办法:在vs 中,打开项目 -> 属性 -> C/C++ -> 预处理器 -> 预处理器定义中添加 _CRT_SECURE_NO_WARNINGS 这个预定义。

报错:namespace "std" 没有成员 "gets" "gets": 不是 "std" 的成员 “gets”: 符号不能用在 using 声明中

解决办法:直接注释掉using std::gets;程序跑通了

文章作者: XyLan
文章链接: https://blog.xylan.cn/2023/04/26/systemC%E7%9A%84%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 XyLan
打赏
  • 微信
  • 支付寶