简体   繁体   中英

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

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...

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM