mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > GMP-ECM

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

28 Posts
Default 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*)'
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
poire is offline   Reply With Quote
Old 2006-03-21, 11:57   #2
cjohnsto
 
Jun 2005

3×5 Posts
Default

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.
cjohnsto is offline   Reply With Quote
Old 2006-03-21, 14:41   #3
poire
 
Mar 2006

2 Posts
Default

This solves the problem.

Thanks a lot.
poire is offline   Reply With Quote
Reply

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 21:13.

Tue Nov 24 21:13:10 UTC 2020 up 75 days, 18:24, 4 users, load averages: 3.16, 2.81, 2.61

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.