Re: GFile issue: undefined reference to `g_file_new_for_path'



On Sun, 4 May 2008 07:34:30 -0400 A. Walton wrote:

On Sun, May 4, 2008 at 7:15 AM, Soulivanh Anothay
<sanothay gmail com> wrote:
Hello everybody,
 I have just manually installed the newer version of GLib 2.16.3 , I
 have checked the installation by issuing this command: "pkg-config
 --modversion glib-2.0" and it returned: "2.16.3
 ". This should confirmed me that the previous installation of GLib
 2.16.3 was successful.

 However, here is my question. When I compiled my program, I got
this message: "undefined reference to `g_file_new_for_path'
 ".

 I do not know the reason why? Please anyone who could give any
suggestion?

 My code was just simple as this:

        GFile* g_file_source = NULL;
        GFile* g_file_dest = NULL;

       g_file_source = g_file_new_for_path
("/home/sanothay/mytest-directory");

      g_file_dest = g_file_new_for_path  ("/media/usb1");

      gboolean return_val = g_file_move (g_file_source, g_file_dest,
 G_FILE_COPY_OVERWRITE , NULL, NULL, NULL, &error);

Be sure you're including libs and cflags for gio-2.0 as well.

And also make sure you're not just linking to the new glib at link
time, but also at run time.  'ldd' can tell you what libraries will get
loaded at run time, and you can use LD_LIBRARY_PATH (assuming you're on
Linux) to mess with that if it's not correct.

        -brian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]