Member Since: Jul 01, 2009
07-01-2009, 06:47 PM
I am trying to compile the following c code with GCC 4.2 using XCode :
int nthreads, tid, NumberOfProcs;
NumberOfProcs = omp_get_num_procs();
printf("\nWorking on %d Processors",NumberOfProcs);
#pragma omp parallel private(tid)
tid = omp_get_thread_num();
printf("\nWoohoo from thread : %d", tid);
nthreads = omp_get_num_threads();
printf("\nMaster says : There is %d out there!", nthreads);
// No more threads
In the project settings I have selected GCC 4.2 and the -fopenmp link option is set by default. Anyway, building with XCode I get errors at link with all openmp routines that cannot be found...
With the following standard Makefile process on my MACPro I have absolutely no such error at link...
CC = /usr/bin/gcc-4.2
CFLAGS = -W -Wall -O3 -fopenmp
LDFLAGS = -fopenmp
SRC = $(wildcard *.c)
OBJS = $(SRC:.c=.o)
AOUT = OpenTest
all : $(AOUT)
OpenTest : $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
%.o : %.c
$(CC) $(CFLAGS) -o $@ -c $<
Any idea to make XCode correctly found the appropriate libs?
Is that possible to show XCode Makefile ?