Pthread Compile Problem
Tom Browder
tbrowder@cox.net
Sat Apr 3 14:54:00 GMT 2004
The following problem occurred for GNU package qdbm:
Given sample program source "test_pthread.cc":
#include <pthread.h>
int
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 test_pthread.cc -static -fstack-check -lpthread
2. g++ -o t test_pthread.cc -fstack-check -lpthread
3. g++ -o t test_pthread.cc -static -lpthread
Execute each file "t":
1. core dump
2. OK
3. OK
What is being done wrong in compile method 1?
Thanks.
Tom Browder
More information about the Gcc-help
mailing list