Jump to content

sc_fixed is undefined in VS 2017


scsc

Recommended Posts

This must be a very simple issue but ... So I had narrowed down to this simple function: 

#include <systemc.h>

void test_overflow_modes()
{
    sc_fixed<6, 4> a = -7;
    cout << " a in dec: " << a << endl;
}

int sc_main(int argc, char* argv[])

{

     test_overflow_modes();

     sc_start();

     return 0;

}

VS2017 had compilation error:
Error (active)    E0020    identifier "sc_fixed" is undefined. 

I checked my installation under /src/sysc/datatypes/fx and saw sc_fixed.h but not sc_fixed.cpp. And I recalled when I compiled this systemc 2.3.2 systemc.sln, I didn't see sc_fixed.cpp was compiled. Is this the problem? What is missing?

Thanks

Link to comment
Share on other sites

Before inlcuding systemc.h you need to define SC_INCLUDE_FX:

#define SC_INCLUDE_FX
#include <systemc>

using namespace sc_core;
using namespace sc_dt;

void test_overflow_modes()
{
    sc_fixed<6, 4> a = -7;
    cout << " a in dec: " << a << endl;
}

...

You'll find that in the LRM...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...