If you get this error message
"undefined reference to `g_thread_init'"
during the compilation of your code, that use GLib.
Solution 1 - Using configure.in
insert the follow code line in your configure.in
AC_CHECK_LIB(gthread-2.0, g_thread_init)
Solution 2 - Compiler command line
add the parameter
-lgthread-2.0
to the compiler.
10 comments:
thanks. i've just googled for the solution of above problem
Thanks, this post is really useful.
Thanks! You just solved my problem after a single Google search.
Same as the rest, thanks!
Thanks A lot..
Thanks very much!
I also got this error and solved less than 1 minute.
Thank u so much for giving good suggestion at right time.
By using this example, we can solve similar kind of problem in future.
I also got this error and solved within 1 minute by seeing this.
With this as a reference, we can solve similar kind of problems in future
Thanks a lot for giving good suggestion at right time.
Kumar HP
This rocks. Had just spent the day working around glib version issues, finally found the correct version of glib that let me update some other libs w/o having to rewrite my code, and ran into this.
I am compiling nspluginviewer. I have only "configure" and no "configure.in". Where do I add this check? I get the error during linking and the message is:
/usr/bin/ld: npviewer-npw-viewer.o: undefined reference to symbol 'g_thread_init'
Thanks.
Post a Comment