Ali
Ali

Reputation: 2025

Linker error after upgrading to Xcode 4

my code was working well with sdk 4.2 but while upgrading the sdk and the xcode to 4 it raise error apple mach-o error

and this is its details

bad codegen, pointer diff in itk::ProcessAborted::ProcessAborted(char const*, unsigned int)to global weak symbol vtable for itk::ProcessAbortedfor architecture armv7 collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

any suggestion to solve this issue ,

itk is a library I built using xcode and g++4.2

Upvotes: 0

Views: 2160

Answers (3)

Marc
Marc

Reputation: 1049

I had to deal with the same problem and finally found a solution:

In Build settings, ensure that "C/C++ Compiler Version" is set to "GCC 4.2" and "Symbols Hidden by Default" is set to "YES"

Then search for "Optimization Level" and change it to "None [-O0]"

If it doesn't work, look at the build settings of your target and check that the same options/values are set

Upvotes: 0

Ross
Ross

Reputation: 14415

Try File > Workspace Settings ( or Project Settings ) and enter the following settings:

  • Derived Data (index, logs, build) Location
    • Custom > Workspace-relative path > 'DerivedData'
  • Build Location
    • Place build products in derived data location
      • Custom Subfolder

This worked for me as my nested projects/libraries we not getting linked properly.

Upvotes: 0

Steve V.
Steve V.

Reputation: 153

Have you tried a complete clean and re-build of the project? Xcode 4 uses LLVM as its default compiler, not g++. If you have part of the project -- or old object files -- kicking around from a g++ build, I could imagine that you might well run into trouble...

Upvotes: 2

Related Questions