Re: [GD-DEVEL] gd with mingw gcc
[email protected] (Patolfo)
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
Hey dude thx for asking, well I am trying both *cough* first tried with
code blocks but did not do the trcik so I swtich back to command line,
from dos console, and well it did not work either.
The example I'm trying is the first one, sadly yet rather simply at
time compile is where the problems arise, let me put you the console output:
Firstly, I forgot, I copy bgd.dll to every possible location I could
imagine :)
inside mingw in the bin lib and inlude folders, yeah this is paranoia,
and also to the windows/system folder as well as in the working directory.
This binary was what I got from:
http://www.libgd.org/releases/oldreleases/gd-2.0.34-win32.zip
from the libgd.org site.
The source code to create a png example:
/* Bring in gd library functions */
#include "gd.h"
/* Bring in standard I/O so we can output the PNG to a file */
#include <stdio.h>
int main() {
/* Declare the image */
gdImagePtr im;
/* Declare output files */
FILE *pngout;
/* 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");
/* Output the image to the disk file in PNG format. */
gdImagePng(im, pngout);
/* Close the files. */
fclose(pngout);
/* Destroy the image in memory. */
gdImageDestroy(im);
}
The compilation command:
g++ ${file_name.c} -lgd -lpng -lz -lm -o $(file_name)
I tried gcc but the error was the same
The output says the following:
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined
reference to 'WinMain@16'
If some one could send me a working example, please do not hesiatate
Bill Frost wrote:
> Hi Patolfo,
>
> I assume you have your own source code with calls to the examples and now
> wish to compile it?
>
> If so, are you using command line or an IDE? I had a little bit of trial and
> error configuring Code::Blocks to run it when I first started 9 months ago
> but it's been flawless ever since and it is a wonderful product!
>
> If you post details about the environment you are working in I'm sure
> someone can help.
>
> I've been using GD to generate graphs of altitude, power, gradient and
> velocity and also latitude / longitude maps from raw GPS data using C++ and
> Code::Blocks and it is a wonderful product.
>
> Cheers,
>
> Bill
>
>
>
> -----Original Message-----
> From: Patolfo [mailto:[email protected]]
> Sent: Tuesday, 8 January 2008 9:56 AM
> To: Pierre
> Cc: [email protected]
> Subject: Re: [GD-DEVEL] gd with mingw gcc
>
> Hi pierre thx for answering, in fact nope I did not comile my self, too
> much trouble , I donwloaded binary versions precompiled for windows,
> from the sourceforge site, I extracted the files into mingw installation
> folder, the problem is that when I tried to compile the examples, the
> compiler stopped because can not find lgd library, and there is where I
> am stuck. Do not know what else to do.
>
> Pierre wrote:
>
>> HI,
>>
>> On Jan 6, 2008 9:49 PM, Patolfo Nery Velya <[email protected]> wrote:
>>
>>
>>> HI guys good day,
>>> well I have downloaded the latest windows version of gd, but when trying
>>>
> to
>
>>> compile says that the compiler can not find lgd
>>>
>>> i am working with mingw and gcc under windows, did you have the same
>>>
> problem
>
>>> and how did you solve it
>>>
>>>
>> Do you compile GD yourself?
>>
>>
>>
>
>