安装VS2013的SystemC [英] Installing SystemC for VS2013

查看:278
本文介绍了安装VS2013的SystemC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Windows 10 64位计算机与Visual Studio Professional 2013一起使用,并且我想安装SystemC.我下载了 SystemC 2.3.1 ,并尝试按照提供的安装说明"进行操作有点过时了.

其中一个说对于Windows 7机器上的VS 2005及更高版本",但我使用的是Windows 10,尽管如此,我仍然尝试遵循它.其次,由于在VS2013中更改了此方法,因此无法按照此处的说明包含srclib文件.通过Tools->Options->Projects->VCC++方向标签,似乎不再有全局设置.

现在,我能够成功构建SystemC.sln解决方案.但是,当我尝试构建示例项目时,出现以下错误:

LINK:致命错误LNK1104:无法打开文件 'C:\ Users \ Andrew \ Downloads \ systemc-2.3.1a \ systemc-2.3.1a \ msvc80 \ SystemC \ Debug.obj'

即使我认为我已经在项目属性中正确指定了srclib目录.

任何人都可以解释如何在Windows 10 x64上使用VS2013构建SystemC吗?

解决方案

更新:如果将CMake与Visual Studio一起使用,请检查 http://accellera.org/downloads/standards/systemc 下载最新的SystemC.

  • 在Visual Studio中打开systemc-2.3.1a \ msvc80 \ SystemC \ SystemC.sln
  • Visual Studio将提供更新解决方案的方法,单击确定".您可以忽略带有警告的报告.
  • 在VS菜单栏中,将配置设置为"Debug""Win32". (在我的情况下,默认情况下已选择)
  • 构建解决方案( F7 )

    在控制台中,您可能会发现以下消息:

    未知的编译器版本-请运行配置测试并报告结果

    您可以忽略它们.解决方案应无错误构建:

    ===========构建:1成功,0失败,0最新,跳过0 =========

  • 因此,您将在systemc-2.3.1a \ msvc80 \ SystemC \ Debug中拥有SystemC.lib

  • 现在您可以创建一些测试SystemC项目.

    1. 文件->新建->项目-> Win32控制台应用程序
    2. 在解决方案资源管理器中的项目上单击鼠标右键->属性"
    3. 在配置属性"->"C/C ++"->常规"->其他包含目录"中

      添加路径到:\ systemc-2.3.1a \ src

    4. 在配置属性"中-> C/C ++->代码生成->运行时库

      选择:多线程调试(/MTd)

    5. 在配置属性"中-> C/C ++->语言->启用运行时类型信息

      选择:是(/GR)

    6. 在配置属性"->"C/C ++"->命令行"->附加选项"中

      类型:/vmg

    7. 在配置属性"->链接器"->常规"->其他库目录"中

      添加以下路径:systemc-2.3.1a \ msvc80 \ SystemC \ Debug

    8. 在配置属性"->链接器"->输入"->其他依赖项"中

      添加: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>
    

    1. 构建项目,它将失败并显示:

      \ systemc-2.3.1a \ src \ systemc.h(120):错误C2039:"gets":不是"std"的成员

    在最新的MSVC中,已从std名称空间中删除了

    gets,但这并不是真正需要的. 因此,只需打开systemc.h并注释掉第120行:

    //    using std::gets;
    

    1. 如果您遇到有关sprintf
    2. 的错误

    _CRT_SECURE_NO_WARNINGS添加到预处理器定义列表中

    1. 再次构建.运行时无需调试( 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.

    1. Download latest SystemC from http://accellera.org/downloads/standards/systemc
    2. Open systemc-2.3.1a\msvc80\SystemC\SystemC.sln in Visual Studio
    3. Visual Studio will offer to update solution, click ok. You can ignore report with warnings.
    4. In VS menu bar set configuration to "Debug" "Win32". (In my case was already selected by default)
    5. 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 ==========

    6. As a result you will have SystemC.lib in systemc-2.3.1a\msvc80\SystemC\Debug

    Now you can create some test SystemC project.

    1. File->New -> Project -> Win32 Console application
    2. Right click on project in solution explorer -> Properties
    3. In Configuration Properties -> C/C++ -> General-> Additional include directories

      Add path to: \systemc-2.3.1a\src

    4. In Configuration Properties -> C/C++ -> Code generation -> Runtime Library

      Select: Multi-threaded Debug (/MTd)

    5. In Configuration Properties -> C/C++ -> Language -> Enable Run-Time Type Information

      Select: Yes (/GR)

    6. In Configuration Properties -> C/C++ -> Command Line -> Additional options

      Type: /vmg

    7. In Configuration Properties -> Linker -> General -> Additional Library Directories

      Add path to: systemc-2.3.1a\msvc80\SystemC\Debug

    8. 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>
    

    1. 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;
    

    1. In case you got error about sprintf

    Add _CRT_SECURE_NO_WARNINGS to list of preprocessor definitions

    1. 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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆