Xcode 4 Error: Undefined symbols for architecture i386

Hi people,

After switching Xcode 4 and oF7 I am haunted by Apple Mach-O Linker (Id) Error…

I can run examples, but whenever I try to create a new project (and add something from addons), I immediately get this error…

The log looks like this:

Ld bin/123Debug.app/Contents/MacOS/123Debug normal i386
cd /Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123
/Developer/usr/bin/g+±4.2 -arch i386 -L/Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123/bin -F/Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123/bin -F/Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123/…/…/…/libs/glut/lib/osx -filelist /Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123/build/123.build/Debug/123.build/Objects-normal/i386/123Debug.LinkFileList -dead_strip …/…/…/libs/poco/lib/osx/PocoFoundation.a …/…/…/libs/poco/lib/osx/PocoNet.a …/…/…/libs/poco/lib/osx/PocoXML.a …/…/…/libs/poco/lib/osx/PocoUtil.a …/…/…/libs/tess2/lib/osx/tess2.a …/…/…/libs/glew/lib/osx/glew.a …/…/…/libs/cairo/lib/osx/cairo-script-interpreter.a …/…/…/libs/cairo/lib/osx/cairo.a …/…/…/libs/cairo/lib/osx/pixman-1.a …/…/…/libs/fmodex/lib/osx/libfmodex.dylib …/…/…/libs/rtAudio/lib/osx/rtAudio.a …/…/…/addons/ofxOpenCv/libs/opencv/lib/osx/opencv.a -framework GLUT /Users/This/Documents/of_preRelease_v007_osx/libs/openFrameworksCompiled/lib/osx/openFrameworksDebug.a -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework OpenGL -framework QuickTime -framework AppKit -framework Cocoa -framework IOKit -o /Users/This/Documents/of_preRelease_v007_osx/apps/addonsExamples/123/bin/123Debug.app/Contents/MacOS/123Debug

Undefined symbols for architecture i386:
“ofxDelaunay::ofxDelaunay(int)”, referenced from:
.
.
.
.
.

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

This log is from ofxDelaunay but I get the same when I try to add OpenCV to new Empty Example…

I tried all the solutions I could find (one by one, altogether and in all possible combinations) such as…

  1. Setting Symbol Hidden by Default to YES (for both example scheme & of scheme)
  2. Clean build
  3. Changed build architecture…
  4. Compared Build Setting of example and new project line by line…

Apparently it’s some Xcode4 nuance, that I’m missing… Can somebody please point out…?

Getting the same error in XCode 4 with OpenNI. Will post if I figure it out.

Did you ever figure this out?

I’ve been having the same problems with compiling in OSX 10.7 XCode 4 on many of the addon examples. Here is one specific example but it is the same problem with most addons I’ve tried to compile. I receive an Undefined symbols for architecture i386 link error. I am compiling everything using 10.6, 32bit with oF007. Does anyone know what’s going on?

Thanks

  
  
Ld bin/MSAFluidExample.app/Contents/MacOS/MSAFluidExample normal i386  
    cd /Developer/OpenFrameworks/of_preRelease_v007_osx/apps/addonsExamples/MSAFLuidExample  
    setenv MACOSX_DEPLOYMENT_TARGET 10.6  
    /Developer/usr/bin/clang++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Developer/OpenFrameworks/of_preRelease_v007_osx/apps/addonsExamples/MSAFLuidExample/bin -L/Developer/OpenFrameworks/of_preRelease_v007_osx/libs/openFrameworksCompiled/lib/osx -F/Developer/OpenFrameworks/of_preRelease_v007_osx/apps/addonsExamples/MSAFLuidExample/bin -F/Developer/OpenFrameworks/of_preRelease_v007_osx/apps/addonsExamples/MSAFLuidExample/../../../libs/glut/lib/osx -filelist /Users/tcfr33/Library/Developer/Xcode/DerivedData/MSAFluidExample-dbmhhastsodlcccjzncbkslxuwxy/Build/Intermediates/MSAFluidExample.build/Release/MSAFluidExample.build/Objects-normal/i386/MSAFluidExample.LinkFileList -mmacosx-version-min=10.6 -dead_strip ../../../libs/poco/lib/osx/PocoFoundation.a ../../../libs/poco/lib/osx/PocoNet.a ../../../libs/poco/lib/osx/PocoXML.a ../../../libs/poco/lib/osx/PocoUtil.a ../../../libs/tess2/lib/osx/tess2.a ../../../libs/glew/lib/osx/glew.a ../../../libs/cairo/lib/osx/cairo-script-interpreter.a ../../../libs/cairo/lib/osx/cairo.a ../../../libs/cairo/lib/osx/pixman-1.a ../../../libs/fmodex/lib/osx/libfmodex.dylib ../../../libs/rtAudio/lib/osx/rtAudio.a /Developer/OpenFrameworks/of_preRelease_v007_osx/libs/openFrameworksCompiled/lib/osx/openFrameworks.a -weak_library /Developer/OpenFrameworks/of_preRelease_v007_osx/libs/openFrameworksCompiled/lib/osx/openFrameworks.a -framework GLUT -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework OpenGL -framework QuickTime -framework AppKit -framework Cocoa -framework IOKit -o /Developer/OpenFrameworks/of_preRelease_v007_osx/apps/addonsExamples/MSAFLuidExample/bin/MSAFluidExample.app/Contents/MacOS/MSAFluidExample  
  
Undefined symbols for architecture i386:  
  "MSA::FluidSolver::enableRGB(bool)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::setFadeSpeed(float)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::setSize(int, int)", referenced from:  
      msaFluidParticlesApp::update() in msaFluidParticlesApp.o  
  "typeinfo for MSA::FluidDrawerBase", referenced from:  
      typeinfo for MSA::FluidDrawerGl in main.o  
  "MSA::FluidDrawerBase::FluidDrawerBase()", referenced from:  
      msaFluidParticlesApp::msaFluidParticlesApp() in main.o  
  "MSA::FluidSolver::FluidSolver()", referenced from:  
      msaFluidParticlesApp::msaFluidParticlesApp() in main.o  
  "MSA::FluidDrawerBase::setDrawMode(MSA::FluidDrawMode)", referenced from:  
      msaFluidParticlesApp::keyPressed(int) in msaFluidParticlesApp.o  
  "MSA::FluidSolver::getWidth() const", referenced from:  
      MSA::FluidDrawerGl::createTexture() in main.o  
  "MSA::FluidSolver::reset()", referenced from:  
      msaFluidParticlesApp::keyPressed(int) in msaFluidParticlesApp.o  
  "MSA::FluidDrawerBase::setup(MSA::FluidSolver*)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
      msaFluidParticlesApp::update() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::setDeltaT(float)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::setVisc(float)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::setColorDiffusion(float)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidDrawerBase::draw(float, float)", referenced from:  
      vtable for MSA::FluidDrawerGl in main.o  
  "MSA::FluidSolver::setup(int, int)", referenced from:  
      msaFluidParticlesApp::setup() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::update()", referenced from:  
      msaFluidParticlesApp::update() in msaFluidParticlesApp.o  
      msaFluidParticlesApp::keyPressed(int) in msaFluidParticlesApp.o  
  "MSA::FluidDrawerBase::draw(float, float, float, float)", referenced from:  
      vtable for MSA::FluidDrawerGl in main.o  
  "MSA::FluidDrawerBase::~FluidDrawerBase()", referenced from:  
      msaFluidParticlesApp::msaFluidParticlesApp() in main.o  
      MSA::FluidDrawerGl::~FluidDrawerGl() in main.o  
      MSA::FluidDrawerGl::~FluidDrawerGl() in main.o  
      msaFluidParticlesApp::~msaFluidParticlesApp() in msaFluidParticlesApp.o  
  "MSA::FluidSolver::~FluidSolver()", referenced from:  
      msaFluidParticlesApp::msaFluidParticlesApp() in main.o  
      msaFluidParticlesApp::~msaFluidParticlesApp() in msaFluidParticlesApp.o  
  "MSA::ColorT<float>::ColorT(MSA::ColorModel, float, float, float)", referenced from:  
      msaFluidParticlesApp::addToFluid(MSA::Vec2<float>, MSA::Vec2<float>, bool, bool) in msaFluidParticlesApp.o  
      Particle::updateVertexArrays(bool, MSA::Vec2<float> const&, int, float*, float*) in Particle.o  
  "MSA::FluidSolver::getHeight() const", referenced from:  
      MSA::FluidDrawerGl::createTexture() in main.o  
ld: symbol(s) not found for architecture i386  
clang: error: linker command failed with exit code 1 (use -v to see invocation)  
  

Hi !
I’ve started playing around with openFramweork for a couple of days and start to really enjoy it… But I’m stuck with this error…
Got the same problem when compiling with an addOn (ofxGifEncoder https://github.com/jesusgollonet/ofxGifEncoder ) on os X 10.8.2 and xCode 4.6

What is weird is that when I compile the example provided with the addon it compiles just fine…

does anybody know why we get this error ? It seems like it’s not specific to this addon… please, my project is stuck…

can you check the build phases section of the target settings ( not OF but see image here for where it is http://www.thinketg.com/Images/Frameworks-2.jpg ) ?

you should see the .cpp files of the addon in there ( compile sources section )

if you don’t can you try re-adding the files to xcode ( drag them into the file section ) and make sure the box is checked for adding the files to the OF app target.

I’m experiencing this problem as well…

With any of the iOS examples, I can build and run and deploy fine.
With a new project (either a copt of emptyExample or from the Project Generator), as soon as I add ofxiPhone, the linker error appears (but doesn’t if I just have ofxAccelerometer). This happens if I add the addon fro the Project Generator, right-click on the addons folder afterwards, or drag-n-drop the addon onto the project afterwards.

After some reading, I looked into making sure there were no examples included in the Addons (there weren’t), and that the addon was added to the Target (it is). I also see all the files in the build phases - of the target, and also in the oF Xcode project.

Make sure your OF libs are built under the same OSX version. For example if you changed the default the build setting of your project to use 10.7 instead of 10.8 make sure to check your dependencies are also built under 10.7 of you’ll get many linker errors.

Where is this checkbox for adding the files to the OF app target? I can’t seem to find it.

Hi. I get here looking about the same error, but I solved it creating a new project and importing the files from the old project. 1 minute solving. Try it.