lunedì 3 settembre 2012

Compilare ncurses e cdk


Esempi di compilazione di sorgenti ncurses e cdk sotto Debian

per entrambe le librerie si possono scaricare i pacchetti gia' compilati (sia libreria che dev)

Nel caso di ncurses
gcc -Wall hello.c -l ncurses -o hello
---------------------------------------------------------------
#include <ncurses.h>

int main()
{
initscr(); /* Start curses mode  */
printw("Hello World !!!"); /* Print Hello World  */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode  */

return 0;
}

---------------------------------------------------------------

Per compilare CDK si devono unire le librerie ncurses e cdk

gcc -Wall hello_ex.c -lcdk -lncurses -o hello_ex

(nel caso di Debian si deve modificare la riga di include presente nel pacchetto originale degli esempi di CDK per farlo puntare alla directory corretta ovvero #include <cdk.h> diventa #include <cdk/cdk.h>
---------------------------------------------------------------

#include <cdk/cdk.h>

int main (int argc, char **argv)
{
   CDKSCREEN *cdkscreen;
   CDKLABEL *demo;
   WINDOW *cursesWin;
   const char *mesg[4];

   CDK_PARAMS params;

   CDKparseParams (argc, argv, &params, CDK_MIN_PARAMS);

   /* Set up CDK. */
   cursesWin = initscr ();
   cdkscreen = initCDKScreen (cursesWin);

   /* Start CDK Colors. */
   initCDKColor ();

   /* Set the labels up. */
   mesg[0] = "</5><#UL><#HL(30)><#UR>";
   mesg[1] = "</5><#VL(10)>Hello World!<#VL(10)>";
   mesg[2] = "</5><#LL><#HL(30)><#LR>";

   /* Declare the labels. */
   demo = newCDKLabel (cdkscreen,
      CDKparamValue (&params, 'X', CENTER),
      CDKparamValue (&params, 'Y', CENTER),
      (CDK_CSTRING2) mesg, 3,
      CDKparamValue (&params, 'N', TRUE),
      CDKparamValue (&params, 'S', TRUE));

   setCDKLabelBackgroundAttrib (demo, COLOR_PAIR (2));


   /* Draw the CDK screen. */
   refreshCDKScreen (cdkscreen);
   waitCDKLabel (demo, ' ');

   /* Clean up. */
   destroyCDKLabel (demo);
   destroyCDKScreen (cdkscreen);
   endCDK ();
return(0);
   //ExitProgram (EXIT_SUCCESS);
}
---------------------------------------------------------------

In Code::Blocks gli switch di compilazione si devono inserire come nell'esempio riportato in immagine



Nessun commento:

Posta un commento

Frane da drone con rete UNET

Alla ricerca di immagini di training gia' pronte per reti neurali mi sono imbattuto nel CAS Landslide Database (scaricabile da  https://...