Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error "Undefined reference to: " #1320

Closed
veripoolbot opened this issue Jun 9, 2018 · 3 comments
Closed

Getting error "Undefined reference to: " #1320

veripoolbot opened this issue Jun 9, 2018 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Jun 9, 2018


Author Name: Kunal Gulati
Original Redmine Issue: 1320 from https://www.veripool.org


I'm trying to interface the output from verilator with c++. But I'm constantly getting the following error:

/tmp/cceMEsUM.o: In function `main':
bsg_squaroot_natlog_test.cpp:(.text+0x71): undefined reference to `Vbsg_squaroot_natlog::Vbsg_squaroot_natlog(char const*)'
bsg_squaroot_natlog_test.cpp:(.text+0x115): undefined reference to `Vbsg_squaroot_natlog::eval()'
bsg_squaroot_natlog_test.cpp:(.text+0x168): undefined reference to `Vbsg_squaroot_natlog::final()'
collect2: error: ld returned 1 exit status

I'm using the following command to compile with g++:

g++ -I obj_dir -I/usr/local/share/verilator/include bsg_squaroot_natlog_test.cpp /usr/local/share/verilator/include/verilated.cpp -o module

Please help me out in this regard.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jun 9, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-06-09T05:42:45Z


You aren't compiling all of the generated files.

You should use the generated makefiles as shown in the examples. Or if you insist on not doing that you'll need to figure out all of the generated c++ files (which may change based on the verilog sources) and compile them all in.

@veripoolbot veripoolbot closed this Jun 9, 2018
@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jun 9, 2018


Original Redmine Comment
Author Name: Kunal Gulati
Original Date: 2018-06-09T06:34:38Z


Yeah, I got it. Thanks a lot. Apart from the documentation, are there any other examples to refer to?
I'm not able to figure out as to how to access the internal signals (just reading and printing them), as well as the parameters passed to the top module via -pvalue.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jun 9, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-06-09T06:38:25Z


See the examples/ in the kit/git or your installation.

Accessing signals from C is covered in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.