473,503 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GMP Compile Error

I tried to use GMP on a Unix machine, but received errors. What should I do?

C++ Code:
#include <iostream>
#include <gmp.h>

int
main ()
{
mpz_t z;
mpz_init (z);
cin >> z;
cout << z << endl;
}

Command:
g++ gmp.cpp

Message:
Undefined first referenced
symbol in file
__gmpz_init /var/tmp/ccvV4wON.o
__ls__FR7ostreamPC12__mpz_struct /var/tmp/ccvV4wON.o
__rs__FR7istreamP12__mpz_struct /var/tmp/ccvV4wON.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Jul 22 '05 #1
2 1626
re******@yahoo.com wrote:
I tried to use GMP on a Unix machine, but received errors. What
should I do?


I have no idea what "GMP" is, but it looks to me as if you forgot to
link your program against the library that provides "GMP".

Jul 22 '05 #2
re******@yahoo.com wrote:
I tried to use GMP on a Unix machine, but received errors. What should I do?

C++ Code:
#include <iostream>
#include <gmp.h>

int
main ()
{
mpz_t z;
mpz_init (z);
cin >> z;
cout << z << endl;
}

Command:
g++ gmp.cpp

Message:
Undefined first referenced
symbol in file
__gmpz_init /var/tmp/ccvV4wON.o
__ls__FR7ostreamPC12__mpz_struct /var/tmp/ccvV4wON.o
__rs__FR7istreamP12__mpz_struct /var/tmp/ccvV4wON.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status


You probably need to link the gmp library ...

g++ gmp.cpp -l<gmp lib>
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2209
by: Danny Boelens | last post by:
Hi all, today I ran into a compile error after a compiler upgrade. I made a small example to demonstrate my compile error: template<typename T1, typename T2> class A {}; class B
5
3301
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
5
3787
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace )...
10
19690
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
6
2834
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
0
1879
by: Jim Heavey | last post by:
Internal Compiler Error: stage 'BEGIN' Hello, I had an application which was working just fine and I decided to modify all database access within the application to utilizie a new Namespace that I...
9
3491
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
4
1830
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following:...
5
5024
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
4119
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.