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 · 4 comments
Closed

Getting error "Undefined reference to: " #1320

veripoolbot opened this issue Jun 9, 2018 · 4 comments
Labels
area: usability Issue involves general usability resolution: no fix needed Closed; no fix required (not a bug)

Comments

@veripoolbot
Copy link
Contributor


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
Copy link
Contributor Author


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
Copy link
Contributor Author


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
Copy link
Contributor Author


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.

@veripoolbot veripoolbot added area: usability Issue involves general usability resolution: nofixneeded resolution: no fix needed Closed; no fix required (not a bug) and removed resolution: nofixneeded labels Dec 22, 2019
@xiaokamikami
Copy link

I got rid of the error when I undid the -o option at compile time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: usability Issue involves general usability resolution: no fix needed Closed; no fix required (not a bug)
Projects
None yet
Development

No branches or pull requests

2 participants