mehmet37 Posted May 22, 2013 Report Share Posted May 22, 2013 Hello everyone, I’m new in systemc and in this forum. I successfully downloaded and installed systemc-2.3.0 on MSVC-2010 (Windows 7) I can compile and run the examples. BUT when I write an own program it doesn’t work. For example I wrote this simple program. #include "systemc.h"#define WIDTH 4 SC_MODULE(adder) { sc_in<sc_uint<WIDTH> > a, b; sc_out<sc_uint<WIDTH> > sum; void do_add() { sum.write(a.read() + b.read()) } SC_CTOR(adder) { SC_METHOD(do_add); sensitive << a << b; } }; systemc.lib(sc_main_main.obj) : error LNK2019: unresolved external symbol> _sc_main referenced in function _sc_elab_and_sim> Debug/addieren.exe : fatal error LNK1120: 1 unresolved externals It seems that the compiler can’t find systemc.lib, but I have add additional libraries in the properties and set the environment variable. I checked it many times but I always got the above-mentioned messages. Can you help me? Thanks in advance. Regards, Aydin Uni Bochum Quote Link to comment Share on other sites More sharing options...
ralph.goergen Posted May 22, 2013 Report Share Posted May 22, 2013 Hi. The problem is not that the linker cannot find the systemc.lib. It searches for an implementation of 'sc_main'. Each SystemC-Modell has to provide a function sc_main(int,char*[]). In some commercial simulator tools this can be replaced by an explicit top module. But with the accellera simulator you need to implement the function. In the sc_main function you instantiate your top level module and/or connect it to a testbench. And you call sc_start here to start the simulation. int sc_main(int argc,char*[] argv) { Top top("top"); sc_start(); return 0; } Greetings Ralph Quote Link to comment Share on other sites More sharing options...
mehmet37 Posted May 22, 2013 Author Report Share Posted May 22, 2013 Hi, now it works. Thank you very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.