Jump to content

In function `sc_dt::sc_uint_base::print(std::ostream&) const': /usr/local/systemc-2.3/include/sysc/datatypes/int/sc_uint_base.h:844: undefined reference to `sc_dt::sc_uint_base::to_string[abi:cxx11](sc_dt::sc_numrep, bool) const'


Recommended Posts

Posted

Hi

I am able to run Hello.cpp and other simple programs - but when try for the code below

I added

        sc_signal< sc_int<4> > a,b,sum;


to my .cpp , i am getting the following issue during linking time

`sc_dt::sc_int_base::print(std::ostream&) const':
/usr/local/systemc-2.3/include/sysc/datatypes/int/sc_int_base.h:865: undefined reference to `sc_dt::sc_int_base::to_string[abi:cxx11](sc_dt::sc_numrep, bool) const'
collect2: error: ld returned 1 exit status
Makefile.rules:150: recipe for target 'a.x' failed

 

My code is pasted below

#include "systemc.h"
SC_MODULE(tff_async_reset){
    sc_in <bool> data,clk,reset;
    sc_out <bool> q;
    bool q_l;
    void atff(){
        if(~reset.read()){
            q_l = 0;
        } else if(data.read()) {
            q_l = !q_l;
        }
        q.write(q_l);
}
    SC_CTOR(tff_async_reset) {
        SC_METHOD (atff);
        sensitive << reset;
        sensitive << clk.pos();
}
};

    int sc_main(int argc , char* argv[]) {
        sc_signal< sc_int<4> > a,b,sum;
        sc_signal<bool> clk;
        return(0);
    }

 

I use the below command for compiling/linking

g++  -g -Wall -pedantic -Wno-long-long -Werror -L. -L.. -L /usr/local/systemc-2.3/lib-linux64/ -Wl,-rpath=/usr/local/systemc-2.3/lib-linux64 -o a.x tff_async_reset.o -lsystemc -lm

 

If I remove the line sc_signal< sc_int<4> > a,b,sum; 

the above command passes

Any help ?

 

rgds

bijoy

Posted

Can you please share some details about your build environment such as compiler version you are using, etc.?

Also kindly share the compilation option used the command that you have shared is showing only the use of object files for input and final executable "a.x" to be compiled and linked.

 

Currently I am able to build the using this command on my system:

g++ -g -Wall -std=c++11 -I $SYSTEMC_HOME/include -L $SYSTEMC_HOME/lib-linux64 -o test.run test.cpp -lsystemc

where g++ -v: g++ 5.4.0

Regards,

Ameya Vikram Singh

  • 2 weeks later...
Posted
On 1/21/2017 at 4:36 PM, bijoy said:

`sc_dt::sc_int_base::print(std::ostream&) const':
/usr/local/systemc-2.3/include/sysc/datatypes/int/sc_int_base.h:865: undefined reference to `sc_dt::sc_int_base::to_string[abi:cxx11](sc_dt::sc_numrep, bool) const'
collect2: error: ld returned 1 exit status
Makefile.rules:150: recipe for target 'a.x' failed

 

On modern GCC versions (starting with 5.x), you the binary interface changed between C++03 and C++11 mode.  You need to build your SystemC library with the same compiler (settings) to get the C++11 version of the functions.

Hope that helps,
  Philipp

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