senseiwa
senseiwa

Reputation: 2499

Xcode 4.2 OpenMP: linker error?

Has anyone ever tried OpenMP on C++ (or C) projects with Xcode 4.2?

It seems that, after enabling OpenMP in projects settings, the linker is given the right flag (-fopenmp), but it won't link. A simple example is this:

Build target aaaa

Ld DerivedData/aaaa/Build/Products/Debug/aaaa normal x86_64
    cd /Users/senseiwa/Desktop/aaaa/aaaa
    setenv MACOSX_DEPLOYMENT_TARGET 10.7
    /Developer/usr/bin/clang++ -arch x86_64 -isysroot 
    /Developer/SDKs/MacOSX10.7.sdk 
    -L[...]/DerivedData/aaaa/Build/Products/Debug 
    -F[...]/DerivedData/aaaa/Build/Products/Debug 
    -filelist [...]/Objects-normal/x86_64/aaaa.LinkFileList 
    -mmacosx-version-min=10.7 
    -fopenmp 
    -o [...]/DerivedData/aaaa/Build/Products/Debug/aaaa

ld: library not found for -lgomp
Command /Developer/usr/bin/clang++ failed with exit code 1

Now, I don't really see what I am doing wrong here, since enabling OpenMP on previous versions was sufficient.

Am I missing something?

Upvotes: 0

Views: 1456

Answers (1)

robince
robince

Reputation: 10967

I don't think the compiler you are using (Clang) supports OpenMP. Try to change the compiler settings in XCode to use GCC 4.2 (which definitely does support openmp).

Upvotes: 1

Related Questions