【发布时间】:2017-10-23 09:22:00
【问题描述】:
我正在尝试使用 CMake 在 SystemC 中构建一个简单的 hello world。
这是 SystemC 文件 main.cpp:
#include <systemc.h>
using namespace std;
SC_MODULE (hello_world) {
SC_CTOR (hello_world) {
}
void say_hello() {
cout << "Hello World SystemC" << endl;
}
};
int sc_main(int argc, char* argv[]) {
hello_world hello("HELLO");
hello.say_hello();
return(0);
}
这里是 CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
project(SystemCExample)
set (CMAKE_PREFIX_PATH /usr/local/systemc-2.3.2)
include_directories(${CMAKE_PREFIX_PATH}/include)
find_library(systemc systemc ${CMAKE_PREFIX_PATH}/lib-linux64)
link_directories(${CMAKE_PREFIX_PATH}/lib-linux64)
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(SystemCExample systemc)
我不断收到错误:
/usr/local/systemc-2.3.2/include/sysc/kernel/sc_ver.h:179: 错误:未定义引用`sc_core::sc_api_version_2_3_2_cxx201103L::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy )'
它指向 sc_ver.h 的行:
api_version_check
(
SC_DEFAULT_WRITER_POLICY
);
当我将 main.cpp 替换为另一个简单示例时,也会出现错误消息。我该如何解决?
【问题讨论】: