Question on using gd lib with c++


 
Thread Tools Search this Thread
Top Forums Programming Question on using gd lib with c++
# 1  
Old 02-19-2009
Question on using gd lib with c++

Hello,

I'm trying to use gd with c++ in linux. Previously, I had already succeed using the gd lib in windows through gdwin32. Now I would like to run the program in linux but i'm not sure how to do it. I'm currently try running it in cygwin, but I couldn't compiled it. Any suggestion?
# 2  
Old 02-20-2009
We need to see the code before we can see why it can't compile. It would also be helpful to see how you're trying to compile it. It'd even be helpful to know what the errors actually were. You've given us very little to go on here...
# 3  
Old 02-22-2009
Sorry about that, here's the detail of my problem. I'm using the gd library to crop an image to a given width and height. In window, I include the gd.h as below:

using namespace std;

#include <float.h> //for DBL_MAX
#include <math.h>

#include <iostream>
#include <fstream>
#include <ctime>
#include "../gdwin32/gd.h"

#define _CANVAS_WIDTH 800
#define _CANVAS_HEIGHT 560
#define _TILE_WIDTH 25
#define _TILE_HEIGHT 20


I actually compiling it as: g++ -o main *.cpp ../gdwin32/libbgd.a and it works.

So now, I'm trying to run the same file in cygwin. I've already installed the zlib, libpng and gd-20.33 in the same folder as the source code which is main.cpp . I've also copied the gd.c and gd.h into the same folder as the source code. I've changed the include part of main.cpp to these:

#include <iostream>
#include <fstream>
#include <ctime>
#include "gd.h"


The problem occur when I run the makefile for gd which gave me these error messages:

extracting exported symbol list from `cygXpm-4.dll'
test -f .libs/impgen.c || \
sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \
*\// { s/^# //;s/^# *$//; p; }" -e d < ./libtool > .libs/impgen.c
test -f .libs/impgen.exe || (cd .libs && \
if test "x" != "x" ; then -o impgen impgen.c ; \
else gcc -o impgen impgen.c ; fi)
.libs/impgen /usr/lib/../bin/cygXpm-4.dll > .libs/cygXpm-4.dll-def
generating import library for `cygXpm-4.dll'
dlltool --as=as --dllname cygXpm-4.dll --def .libs/cygXpm-4.dll-def --output-lib
.libs/libimp-cygXpm-4.a
grep: /usr/lib/libiconv.la: No such file or directory
/usr/bin/sed: can't read /usr/lib/libiconv.la: No such file or directory
libtool: link: `/usr/lib/libiconv.la' is not a valid libtool archive
make[2]: *** [libgd.la] Error 1
make[2]: Leaving directory `/home/shah/hsv/gd-2.0.33'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/shah/hsv/gd-2.0.33'
make: *** [all] Error 2

I'm not sure how to fix this and actually don't have a clue how to compile the program. Could anyone help me on how to use gd with c++ in linux?
# 4  
Old 02-25-2009
You shouldn't be compiling gd yourself at all, you should install it and its headers on your system with the package manager for your distro. It will know what other packages it needs to install before it installs gd itself, which are probably several. Nor should you need to copy headers, you should make sure you're using the header files that your package manager installs. (the pkg-config command may be useful for this.)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Can't CD to lib ??? why

Hi, I have root access and user name called prod. but it doesn't matter which user I log in as. But I can't CD to the directory. Can you advise. dr-xr-xr-x 1 root root 1 Sep 12 15:40 lib $id uid=4902(prod) gid=50(develop) $cd lib -bash: cd: lib: Permission... (7 Replies)
Discussion started by: samnyc
7 Replies

2. AIX

Lib files

Hi All, I am trying to install IIS Suite application on AIX box. It gave an error as below Ensure the following libraries do not exist: /usr/lib/libicuio.a, /usr/lib/libicuuc.a, /usr/lib/libicui18n.a. These libraries may cause uvsh to not work properly. I manually removed these files by... (1 Reply)
Discussion started by: tostay2003
1 Replies

3. AIX

LIB Version

Hi...please help with command to find the library version on AIX server ---------- Post updated at 12:50 PM ---------- Previous update was at 12:31 PM ---------- AIX version is 6.1.Please (4 Replies)
Discussion started by: Sanal
4 Replies

4. Red Hat

Lib missing

Hai dear, I am installing some application on linux RedHat 9 It gives me following discrepancies lib.so.6 (GLIBC_2.3.4) needed lib.so.6 (GLIBC_2.4) needed libpthread.so.0(GLIBC_2.3.3) needed rtld(GNU_HASH) needed i tried to search a lot on internet to find relative rpm for these libs... (3 Replies)
Discussion started by: Danish Shakil
3 Replies

5. Red Hat

ls: /lib/libattr.so.1: no version information available (required by /lib/libacl.so.1)

Hello, I'm experimenting a problem on my rh server. Red Hat Enterprise Linux AS release 3 (Taroon Update 8) 2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux It started with a segmentation fault on #id root To resolve it, I've installed coreutils-4.5.3-28.4.i386.rpm But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

6. Programming

2D Graphics Lib

Hi, I am on Fedora9 and need to do some simple 2D graphics (for game development). I am looking for an ideal 2D library/package to be used with GCC. I have come accross GRX, libmxi and some OpenGL (The 3D), but none of which seems to be ok. I could not find any tutorial or support material... (1 Reply)
Discussion started by: nasersh
1 Replies

7. Programming

To use lib or lib32?

A good day to you, dear experts, I am a newbie, I noticed in binutils or gcc there are lib and lib32 and lib64, to take binutils as an example, My system is sgi IRIX6.5, which is suggested to use "n32" flag during the compiling and linking, is that mean that I need to use lib32? Q1. which one... (2 Replies)
Discussion started by: lakeat
2 Replies

8. Linux

ct-lib on Lynix

Hi Friends ! Where can I get free ct-lib for Lynix ?? My problem is something like this-- Sybase server is running on a Solaris machine. Now I trying to access the Sybase from a Lynix machine for which i need ct-lib. I tried by downloading some free ct-libs for Lynix on the net, but they... (2 Replies)
Discussion started by: mrgubbala
2 Replies

9. Programming

LIB question

a program on linux uses three libs: libutil.a libtermcap.a libpthread.a. If I want to transplant this program to Solaris, where can I get the three libs? Thanks. (2 Replies)
Discussion started by: hewlet
2 Replies

10. UNIX for Dummies Questions & Answers

/usr/lib/32/32-> Question

Hello UNIX people. I was just cruising around my UFS and came across the directory /usr/lib/32. This directory continues up many directories (/usr/lib/32/32/32/32->). Each level of 32/ directory seems to be a copy of the previous one. I have been working with UNIX for a little while now, but I... (3 Replies)
Discussion started by: shaggy
3 Replies
Login or Register to Ask a Question