OpenMp and XCode 3.1.2 link pb

Joined
Jul 1, 2009
Messages
1
Reaction score
0
Points
1
Hello,

I am trying to compile the following c code with GCC 4.2 using XCode :

#include <omp.h>
#include <stdio.h>

void main(){

int nthreads, tid, NumberOfProcs;


NumberOfProcs = omp_get_num_procs();
printf("\nWorking on %d Processors",NumberOfProcs);

omp_set_num_threads(NumberOfProcs);

#pragma omp parallel private(tid)
{
tid = omp_get_thread_num();
printf("\nWoohoo from thread : %d", tid);
if (tid==0){
nthreads = omp_get_num_threads();
printf("\nMaster says : There is %d out there!", nthreads);
}
}
printf("\n");
// 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 $<

clean :
@rm *.o

Any idea to make XCode correctly found the appropriate libs?
Is that possible to show XCode Makefile ?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top