Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22014

Pthread and gcc compiling issue on OS X

$
0
0

I have a script that compiles fine on Linux (Ubuntu 11.04), but not on OS X (Lion).

gcc -pthread -o hw1 hw1.c 
hw1.c:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘barr’
hw1.c: In function ‘__syncthreads’:
hw1.c:53: error: ‘barr’ undeclared (first use in this function)
hw1.c:53: error: (Each undeclared identifier is reported only once
hw1.c:53: error: for each function it appears in.)
hw1.c:54: error: ‘PTHREAD_BARRIER_SERIAL_THREAD’ undeclared (first use in this function)
hw1.c: In function ‘parallel_psum’:
hw1.c:94: error: ‘barr’ undeclared (first use in this function)
hw1.c:107: warning: assignment from incompatible pointer type

Here's the first 22 lines of the code:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <sys/time.h>
#include <pthread.h>
#include <assert.h>

/* create thread argument struct for thr_func() */
typedef struct _thread_data_t {
    int tid;
    int* ints;
    int* sums;
    int num_ints;
    int* temp;
} thread_data_t;

const int MIN_RAND_INT = 1;
const int MAX_RAND_INT = 65000;

// pthreads barrier variable
pthread_barrier_t barr;

Any ideas why this is happening?


Viewing all articles
Browse latest Browse all 22014

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>