安装VS2013的SystemC [英] Installing SystemC for VS2013
问题描述
我正在将Windows 10 64位计算机与Visual Studio Professional 2013一起使用,并且我想安装SystemC.我下载了 SystemC 2.3.1 ,并尝试按照提供的安装说明"进行操作有点过时了.
其中一个说对于Windows 7机器上的VS 2005及更高版本",但我使用的是Windows 10,尽管如此,我仍然尝试遵循它.其次,由于在VS2013中更改了此方法,因此无法按照此处的说明包含src
和lib
文件.通过Tools->Options->Projects->VCC++
方向标签,似乎不再有全局设置.
现在,我能够成功构建SystemC.sln解决方案.但是,当我尝试构建示例项目时,出现以下错误:
LINK:致命错误LNK1104:无法打开文件 'C:\ Users \ Andrew \ Downloads \ systemc-2.3.1a \ systemc-2.3.1a \ msvc80 \ SystemC \ Debug.obj'
即使我认为我已经在项目属性中正确指定了src
和lib
目录.
任何人都可以解释如何在Windows 10 x64上使用VS2013构建SystemC吗?
更新:如果将CMake与Visual Studio一起使用,请检查 http://accellera.org/downloads/standards/systemc 下载最新的SystemC.
构建解决方案( F7 ) 在控制台中,您可能会发现以下消息: 未知的编译器版本-请运行配置测试并报告结果 您可以忽略它们.解决方案应无错误构建: ===========构建:1成功,0失败,0最新,跳过0 ========= 因此,您将在systemc-2.3.1a \ msvc80 \ SystemC \ Debug中拥有SystemC.lib 现在您可以创建一些测试SystemC项目. 在配置属性"->"C/C ++"->常规"->其他包含目录"中 添加路径到:\ systemc-2.3.1a \ src 在配置属性"中-> C/C ++->代码生成->运行时库 选择:多线程调试(/MTd) 在配置属性"中-> C/C ++->语言->启用运行时类型信息 选择:是(/GR) 在配置属性"->"C/C ++"->命令行"->附加选项"中 类型:/vmg 在配置属性"->链接器"->常规"->其他库目录"中 添加以下路径:systemc-2.3.1a \ msvc80 \ SystemC \ Debug 在配置属性"->链接器"->输入"->其他依赖项"中 添加:SystemC.lib 现在是时候键入一些代码了.例如下面的"Hello world": 在
#include "stdafx.h"
struct test_module : sc_module {
SC_HAS_PROCESS(test_module);
test_module(::sc_core::sc_module_name) {
SC_THREAD(test_thread);
}
sc_signal<std::string> message{ "message" };
void test_thread() {
message.write("Hello world!");
wait(1, SC_NS);
cout << message.read() << endl;
sc_stop();
}
};
int sc_main(int argc, char** argv)
{
test_module tmod{ "tmod" };
sc_start();
return 0;
}
stdafx.h
中添加: #include <systemc.h>
\ systemc-2.3.1a \ src \ systemc.h(120):错误C2039:"gets":不是"std"的成员
在最新的MSVC中,已从std
名称空间中删除了
gets
,但这并不是真正需要的.
因此,只需打开systemc.h
并注释掉第120行:
// using std::gets;
- 如果您遇到有关
sprintf
的错误
将_CRT_SECURE_NO_WARNINGS
添加到预处理器定义列表中
- 再次构建.运行时无需调试( Ctrl + F5 ).您应该在控制台上看到以下引入测试:
SystemC 2.3.1-Accellera --- Feb 1 2017 14:43:06 Copyright (c) 1996-2014 by all Contributors, ALL RIGHTS RESERVED Hello world! Info: /OSCI/SystemC: Simulation stopped by user. Press any key to continue . . .
希望有帮助
I am using Windows 10 64-bit machine with Visual Studio Professional 2013 and I want to install SystemC. I downloaded SystemC 2.3.1 and I tried following the "Installation notes" provided but they're slightly outdated.
For one, it says "for VS 2005 and higher on Windows 7 machines" but I am using Windows 10, nevertheless I still tried to follow it. Second, the inclusion of src
and lib
files cannot be followed as stated there since this method was changed in VS2013. There seems to be no global setting anymore via Tools->Options->Projects->VCC++
directions tab.
Now, I was able to successfully buiold the SystemC.sln solution. However, when I tried to build an example project I got the following error:
LINK : fatal error LNK1104: cannot open file 'C:\Users\Andrew\Downloads\systemc-2.3.1a\systemc-2.3.1a\msvc80\SystemC\Debug.obj'
Even though I think I've correctly specified the src
and lib
directories in the project properties.
Can anyone explain how to build SystemC with VS2013 on Windows 10 x64?
Update: if you use CMake with Visual Studio, check Setting up a SystemC project with CMake: undefined reference to `sc_core
Currently I have no MSVC2013 installed, so here are steps for MSVC2017 that worked for me.
- Download latest SystemC from http://accellera.org/downloads/standards/systemc
- Open systemc-2.3.1a\msvc80\SystemC\SystemC.sln in Visual Studio
- Visual Studio will offer to update solution, click ok. You can ignore report with warnings.
- In VS menu bar set configuration to "Debug" "Win32". (In my case was already selected by default)
Build solution (F7)
In console, you may find messages like:
Unknown compiler version - please run the configure tests and report the results
You can ignore them. Solution should build without errors:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
As a result you will have SystemC.lib in systemc-2.3.1a\msvc80\SystemC\Debug
Now you can create some test SystemC project.
- File->New -> Project -> Win32 Console application
- Right click on project in solution explorer -> Properties
In Configuration Properties -> C/C++ -> General-> Additional include directories
Add path to: \systemc-2.3.1a\src
In Configuration Properties -> C/C++ -> Code generation -> Runtime Library
Select: Multi-threaded Debug (/MTd)
In Configuration Properties -> C/C++ -> Language -> Enable Run-Time Type Information
Select: Yes (/GR)
In Configuration Properties -> C/C++ -> Command Line -> Additional options
Type: /vmg
In Configuration Properties -> Linker -> General -> Additional Library Directories
Add path to: systemc-2.3.1a\msvc80\SystemC\Debug
In Configuration Properties -> Linker -> Input -> Additional dependencies
Add: SystemC.lib
Now it's time to type some code. For example this "Hello world":
#include "stdafx.h"
struct test_module : sc_module {
SC_HAS_PROCESS(test_module);
test_module(::sc_core::sc_module_name) {
SC_THREAD(test_thread);
}
sc_signal<std::string> message{ "message" };
void test_thread() {
message.write("Hello world!");
wait(1, SC_NS);
cout << message.read() << endl;
sc_stop();
}
};
int sc_main(int argc, char** argv)
{
test_module tmod{ "tmod" };
sc_start();
return 0;
}
In stdafx.h
add:
#include <systemc.h>
- Build project, it will fail with:
\systemc-2.3.1a\src\systemc.h(120): error C2039: 'gets': is not a member of 'std'
gets
was removed from std
namespace in latest MSVCs, but it is not really required.
So just open systemc.h
and comment out Line 120:
// using std::gets;
- In case you got error about
sprintf
Add _CRT_SECURE_NO_WARNINGS
to list of preprocessor definitions
- Build again. Run without debugging (Ctrl+F5). You should see the following introduction test on your console:
SystemC 2.3.1-Accellera --- Feb 1 2017 14:43:06 Copyright (c) 1996-2014 by all Contributors, ALL RIGHTS RESERVED Hello world! Info: /OSCI/SystemC: Simulation stopped by user. Press any key to continue . . .
Hope that helps
这篇关于安装VS2013的SystemC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!