Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Beginning With GD and XCode C Program

Beginning With GD and XCode C Program
Thread Tools
BostonMACOSX
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Jan 30, 2004, 08:45 PM
 
Below is the code I tried to use in Xcode to crease a simple routin with the GD.h header to output an image.

I consistently get:
ZeroLink: unknown symbol '_gdImageCreate'
from XCode.

I think that I'm pointing to the header file correctly. Any Ideas on why I'm receiving this message.

Thankks. The example is drectly from the GD site.


#include "/sw/include/gd.h"
#include <stdio.h>

int main () {
/* Declare the image */
gdImagePtr im;
/* Declare output files */
FILE *pngout, *jpegout;
/* Declare color indexes */
int black;
int white;

/* Allocate the image: 64 pixels across by 64 pixels tall */
im = gdImageCreate(64, 64);

/* Allocate the color black (red, green and blue all minimum).
Since this is the first color in a new image, it will
be the background color. */
black = gdImageColorAllocate(im, 0, 0, 0);

/* Allocate the color white (red, green and blue all maximum). */
white = gdImageColorAllocate(im, 255, 255, 255);

/* Draw a line from the upper left to the lower right,
using white color index. */
gdImageLine(im, 0, 0, 63, 63, white);

/* Open a file for writing. "wb" means "write binary", important
under MSDOS, harmless under Unix. */
pngout = fopen("test.png", "wb");

/* Do the same for a JPEG-format file. */
jpegout = fopen("test.jpg", "wb");

/* Output the image to the disk file in PNG format. */
gdImagePng(im, pngout);

/* Output the same image in JPEG format, using the default
JPEG quality setting. */
gdImageJpeg(im, jpegout, -1);

/* Close the files. */
fclose(pngout);
fclose(jpegout);

/* Destroy the image in memory. */
gdImageDestroy(im);
return 0;
}
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Jan 30, 2004, 10:40 PM
 
You need to link to libgd.a, like it says in the GD documentation. You can do that by adding it as a framework, I believe. I haven't used GD on a Mac so I'm not sure if there are any other quirks.
     
BostonMACOSX  (op)
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Jan 30, 2004, 11:10 PM
 
Originally posted by itai195:
You need to link to libgd.a, like it says in the GD documentation. You can do that by adding it as a framework, I believe. I haven't used GD on a Mac so I'm not sure if there are any other quirks.
I'm pouring through the libraries and the ony one i think that it is having trouble finding is one for crc32. Amy help appreciated.

Thanks very much
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:25 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,