Jump to content

undefined reference to `myclass::function()'


NicoCaldo

Recommended Posts

So,

I'm trying to compile my main.cpp that includes three modules. For instance I got a module counter with this .h file

#include <systemc.h>

SC_MODULE(counter) {

	sc_in<bool> clk; //porta ingresso clock
	sc_in<bool> load; //porta ingresso load
	sc_in<bool> clear; //porta ingresso clear
	sc_in<sc_uint<8> > din; //porta ingresso dato (intero 8 bit)
	sc_out<sc_uint<8> > dout; //porta uscita dato (intero 8 bit)

	unsigned int countval; //valore del contatore (intero senza segno)

	void counting(); //funzione conteggio (il mio processo)

	SC_CTOR(counter) { //costruttore di counting()

		SC_METHOD(counting); //costruttore del mio processo attraverso metodo (meglio del thread)

		sensitive << clk.pos(); //sensibile al fronte del clock, positivo
	}
};

now, when I run the compiler with

g++ -I/usr/local/systemc-2.3.3/include -L/usr/local/systemc-2.3.3/lib-linux64/ -lsystemc -lm -o out main.cpp

but I got this error

/tmp/ccz92lN5.o: In function `counter::counter(sc_core::sc_module_name)':
main.cpp:(.text._ZN7counterC2EN7sc_core14sc_module_nameE[_ZN7counterC5EN7sc_core14sc_module_nameE]+0xba): undefined reference to `counter::counting()'

How do I fix it?

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