Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1135 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  Problème avec GD

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème avec GD

n°1526985
lasvegasth​eking
Posté le 11-03-2007 à 02:17:25  profilanswer
 

Bonsoir,
 
pour tester l'installation de GD chez nous, un prof nous a fourni un code de test.
J'ai installé toutes les bibliothèques mais j'obtiens cette erreur :

Code :
  1. g++ -lgd -lpng -lz -ljpeg -lfreetype -lm gd.cc
  2. /tmp/ccqjEmrL.o: dans la fonction « main »:
  3. gd.cc:(.text+0xc5): référence indéfinie vers « gdImageJpeg »
  4. collect2: ld a retourné 1 code d'état d'exécution


Je ne comprends pas pourquoi gdImageJpeg n'est pas reconnue
 
Voici le code :

Code :
  1. /* Bring in gd library functions */
  2. extern "C" {
  3. #include <gd.h>
  4.        }
  5. /* Bring in standard I/O so we can output the PNG to a file */
  6. #include <stdio.h>
  7. int main() {
  8.     /* Declare the image */
  9.     gdImagePtr im;
  10.     /* Declare output files */
  11.     FILE *pngout, *jpegout;
  12.     /* Declare color indexes */
  13.     int black;
  14.     int white;
  15.     /* Allocate the image: 64 pixels across by 64 pixels tall */
  16.     im = gdImageCreate(64, 64);
  17.     /* Allocate the color black (red, green and blue all minimum).
  18.         Since this is the first color in a new image, it will
  19.         be the background color. */
  20.     black = gdImageColorAllocate(im, 0, 0, 0); 
  21.     /* Allocate the color white (red, green and blue all maximum). */
  22.     white = gdImageColorAllocate(im, 255, 255, 255); 
  23.  
  24.     /* Draw a line from the upper left to the lower right,
  25.         using white color index. */
  26.     gdImageLine(im, 0, 0, 63, 63, white); 
  27.     /* Open a file for writing. "wb" means "write binary", important
  28.         under MSDOS, harmless under Unix. */
  29.     pngout = fopen("test.png", "wb" );
  30.     /* Do the same for a JPEG-format file. */
  31.     jpegout = fopen("test.jpg", "wb" );
  32.     /* Output the image to the disk file in PNG format. */
  33.     gdImagePng(im, pngout);
  34.     /* Output the same image in JPEG format, using the default
  35.         JPEG quality setting. */
  36.     gdImageJpeg(im, jpegout, -1);
  37.     /* Close the files. */
  38.     fclose(pngout);
  39.     fclose(jpegout);
  40.     /* Destroy the image in memory. */
  41.     gdImageDestroy(im);
  42. }

mood
Publicité
Posté le 11-03-2007 à 02:17:25  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  Problème avec GD

 

Sujets relatifs
probleme avec dblookupcombobox (probleme2)probleme avec dblookupcombobox (probleme 1)
Problème pour invoquer un session bean dans une servletprobleme structuration BD
[CSS] problème de bloc - ajout d'imagesProbleme avec header
Problème de jointure mysqlprobleme de boucle dans Excel
Problème avec un fichier externe pour mes variablesproblème php avec nuked clan
Plus de sujets relatifs à : Problème avec GD


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR