Pthread Compile Problem

Tom Browder
Sat Apr 3 14:54:00 GMT 2004

The following problem occurred for GNU package qdbm:

Given sample program source "":

#include <pthread.h>
main(int argc, char** argv)
  pthread_mutex_t mutex;
  pthread_mutex_init(&mutex, NULL);
  return 0;

Compile three ways (using gcc 3.3.2 20031022 (RH Linux 3.3.2-1)):
1. g++ -o t -static -fstack-check -lpthread
2. g++ -o t -fstack-check -lpthread
3. g++ -o t -static -lpthread

Execute each file "t":
1. core dump
2. OK
3. OK

What is being done wrong in compile method 1?


Tom Browder

More information about the Gcc-help mailing list