Go Back > Factoring Projects > GMP-ECM

Thread Tools
Old 2006-03-20, 15:41   #1
Mar 2006

2 Posts
Default Can't bind libecm.a with C++ files

When I try to bind libecm.a with a C++ file, I get
 undefined reference to `ecm_factor(__mpz_struct*, __mpz_struct*, double, __ecm_param_struct*)'
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.

poire is offline   Reply With Quote
Old 2006-03-21, 11:57   #2
Jun 2005

3·5 Posts

C++ mangles names but C does not. I believe this is the reason for the problem.
To solve it change:
#include <ECM.h>
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.
cjohnsto is offline   Reply With Quote
Old 2006-03-21, 14:41   #3
Mar 2006

2 Posts

This solves the problem.

Thanks a lot.
poire is offline   Reply With Quote

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Posting log files or other text files Xyzzy Forum Feedback 3 2018-12-30 19:37
Is libecm thread-safe? frmky GMP-ECM 5 2009-02-28 16:08
Help using .ini files only in v24 petrw1 PrimeNet 1 2008-10-15 03:24
using libecm from python yqiang GMP-ECM 2 2007-04-22 00:14
The Status Files Axel Fox PrimeNet 3 2004-07-20 02:27

All times are UTC. The time now is 07:56.

Sat Nov 27 07:56:26 UTC 2021 up 127 days, 2:25, 0 users, load averages: 0.87, 1.03, 1.08

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.