[Top][All Lists]

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

Re: [XForms] Xforms & threads-functions & others

From: Jens Thoms Toerring
Subject: Re: [XForms] Xforms & threads-functions & others
Date: Fri, 7 Oct 2011 11:12:28 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Sergey,

On Thu, Oct 06, 2011 at 05:17:02PM -0700, Sergey Klimkin wrote:
> When compiling a files created in the fd-xforms appear strange problems.
> Here are some of them:
> 1. How to use the xforms with threads-finctions from pthread.h ?
> The compiler gcc does not see the library function # include <pthread.h>  //  
> /usr/include/pthread.h
> terminal:
> survey.c: undefined reference to `pthread_create'
> survey.c: undefined reference to `pthread_join'
> survey.c: undefined reference to `pthread_cancel'
> A little earlier I compiled (gcc) the exact same project created in GTK+
> And the compiler sees the library and functions for threads.

What you got there is a linker, not a compiler error (all lines
starting with "undefined reference to" typically are from the
linker). And thus it means that you're missing a required li-
brary. Obviously, it's the library for POISX threads, so the
problem probably can be resolved by adding '-lpthread' to the
options you use for compiling and linking, just like you need
'-lforms' to get the linker to link against the XForms library.

That it works with GTK+ is due to some "magic incantations"
you typically use when building GTK+ applications. There
you usually use something like

gcc `pkg-config --cflags --libs gtk+-2.0` hello.c -o hello

and the stuff within backtics (i.e. "pkg-config --cflags --libs
gtk+-2.0") is running a program that emits text for  a lot of
additional compiler/linker options needed for GTK+. And these
rather likely also contain '-lptreads' or something similar,
so the POSIX threads library will be linked against by default.

BTW, be careful: you only can invoke XForms functions from a
single thread (or you need to use some form of exclusion to
avoid having XForms functions called asynchronously) - Xforms
does not set up X11 for being thread-safe, so having several
threads call XForms functions will rather likely result in
fatal X errors. Moreover, the XForms library is also not
thread-safe itself.

> 2. The compiler does not see the functions of callback.
> I hand-carried them out xxx_cb.c in xxx_main.c - there a better way?

My best guess is that this is again a linker error (you would
have to post the exact error messages). Are you sure that the
xxx_cb.o file is part of what you link together? I.e. do you
use a command to compile and link like

gcc -o xxx xxx.c xxx_cb.c xxx_main.c -lforms

It would be helpful if you would show the command(s) you use
and the error messages you get. 

> 3. The compiler gcc can not load pixmapfile.xpm 
> terminal: In fl_read_pixmapfile () [pixmap.c: 631] error reading 
> /home/sklimkin/projects/fdesign/surveyfd/Garmin_iPAQ.xpm (Can't open)
> May-be necessary to use another type of image (bmp, gif, jpg)?

That doesn't look like a compiler (or linker) error but like
an error your program emits when it's running. And then it's
simply the result of an underlying Xpm function for loading
the file, reporting that the requested file can't be opened.
This typically is either due to the file not existing or you
not having the proper permissions to open the file for rea-

> 4. Is it possible to attach to the message file (a picture or zip) for
> clarity?
> If not, then where to put the specified files, with reference to them?

Sorry, but what's a "message file"? I don't understand what this
question is about. Could you try to give abit more of an expla-
nation what you're trying to do?

                              Regards, Jens
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]