我使用本教程安装了SystemC库2.3.1。
我写了这个hello world例子:
//hello.cpp
SC_MODULE(hello_world){ SC_CTOR(hello_world){ }
无效……
你好像从网页上复制了代码。请记住 和“”不是一回事。在第8行
cout << ��Hello World systemc-2.3.0.\n��;
用它替换它
cout << "Hello World systemc-2.3.0.\n";
并在第13行
hello_world hello(��HELLO��);
hello_world hello("HELLO");
然后再次执行代码。 祝好运。
std::gets 已在C ++ 11中删除(参见 什么是C11中的gets()等价? )
std::gets
如果您使用C ++ 11标志构建(可能使用g ++别名),则必须禁用此行 systemc.h 。
systemc.h
更换
using std::gets;
同
#if defined(__cplusplus) && (__cplusplus < 201103L) using std::gets; #endif
正如guyguy333所提到的,在新版本中,g ++是C ++ 11的别名。 所以加 -std=c++98 会解决问题。 编译命令可能会喜欢
-std=c++98
$ g++ -std=c++98 -lsystemc -pthread main.cpp -o main