How to link a static library

I have built quickjs successful, but link to rust fail. I check target dir, the libquickjs.a file is exist. and how to fix it this error?

look at the error message, you are passing the linker argument wrong. the syntax to add a library to ld is -lfoo, not -llibfoo.a, and the directory is passed via -Ldir. for example, if you file is located at /tmp/foobar/libfoobar.a, the correct command line to the linker should be ld ... -L/tmp/foobar -lfoobar. please note for the classic unix linker, the order of input files to the linker matters, this includes both .o files and -l flags. modern replacement linker might be smart enough to relax the order restrictions, but you should check your linkers user manual.

1 Like

thank you very much it works

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.