bijoy

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'

3 posts in this topic

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

AmeyaVS likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now