![]() |
Can't bind libecm.a with C++ files
When I try to bind libecm.a with a C++ file, I get
[CODE] undefined reference to `ecm_factor(__mpz_struct*, __mpz_struct*, double, __ecm_param_struct*)'[/CODE] I know that gcc finds the right libecm.a file because there's a different error message when I delete or rename it. The library works fine when I use it in C files. I'm using: gmp-ecm 6.0.1 gmp 4.1.4 gcc 3.3.4 on x86 Linux Any help is greatly appreciated. Thanks, poire |
C++ mangles names but C does not. I believe this is the reason for the problem.
To solve it change: #include <ECM.h> to extern "C" { #include <ECM.h> } I hope that helps. Basically this tells the linker to look for the unmangled version of these functions i.e. the C version. Please tell us how you go with this fix. This is from memory so I hope it contains no mistakes. |
This solves the problem.
Thanks a lot. |
All times are UTC. The time now is 23:02. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.