Centos compilation and installation of glib

Source: Internet
Author: User
Tags parse error

Download the latest glib.2.28.2

./Configure -- prefix =/usr

Make clean & make install

 

(1) Problems Encountered

The magic. h header file is missing during make. This header file does not exist in/usr/include/Linux/of centos;

 

(2) make this error: http://blog.csdn.net/saint1126/archive/2011/01/17/6147169.aspx

Make [4]: Entering directory '/root/desktop/glib-2.26.0/Gio/tests'

/Usr/bin/msgfmt-O test.mo./DE. Po ;/

  • /Bin/mkdir-P de/lc_messages ;/
  • CP-F test.mo de/lc_messages
  • ./DE. Po: 15: the keyword "msgctxt" is unknown.
  • ./DE. Po: 15: 8: Parse error
  • /Usr/bin/msgfmt: two fatal errors are detected.
  • Cause: to upgrade the gettext package library, perform the following operations:

    1. Wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
    2. Tar xvzf gettext-0.18.1.1.tar.gz
    3. CD gettext-0.18.1.1
    4. ./Configure
    5. Make
    6. Make install
    7. Ldconfig

    Here we randomly find a test on the Internet:

    /* Until. C is used to test practical functions */
    # Include <glib. h>
    Int main (INT argc, char * argv [])
    {
    Grand * rand;
    Gtimer * timer;
     
    Gint N;
    Gint I, J;
    Gint x = 0;
    Rand = g_rand_new (); // creates a random number object.
    For (n = 0; n <20; n ++)
    {// Generate a random number and display it
    G_print ("% d/T", g_rand_int_range (RAND 1,100 ));
    }
    G_print ("/N ");
    G_rand_free (RAND); // release the random number object.
    // Create a timer
    Timer = g_timer_new ();
    G_timer_start (timer); // start timing
    For (I = 0; I <10000; I ++)
    For (j = 0; j <3000; j ++)
    X ++; // accumulative
    G_timer_stop (timer); // time end
    // Output timing results
    G_print ("% LD/tall: %. 2f seconds was used! /N ", X, g_timer_elapsed (timer, null ));
    }

    Use this compilation: gcc-g'pkg-config -- cflags -- libs glib-2.0 't_glib.c-O t_glib

     

     

     

    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.