Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Trying to compile following code in terminal i got

gcc: -pthread: No such file or directory,

what does this error means and how to eliminate it?

file name: window.c

code:

#include <gtk/gtk.h>

int main(int argc, char *argv[]) {

  GtkWidget *window;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 
  gtk_widget_show(window);

  gtk_main();
  return 0;

}

I tried to compile it with following parameters:-

gcc -Wall -g window.c -o window `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
share|improve this question

1 Answer 1

up vote 4 down vote accepted

It most likely means that your system doesn't have the development portion of the threading library installed. You can find out what thread -pthread flag does on your platform with the following command:

gcc -dumpspecs | grep "%{pthread"

I get this:

%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
%{pthread:-lpthread}    %{shared:-lc}    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}

Which means that -pthread on my system adds -D_REENTRANT and -lpthread. So the missing file would be libpthread.sometihing.

share|improve this answer
    
At this point, the terminal compiles fine. But the error message still shows up when i try to compile the source through Shell Script or IDEs like Geany –  user24665 Nov 18 '11 at 13:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.