Search code examples
c++xcodexcode4objective-c++

Cannot use a C++ file in Xcode - Cannot Resolve Libs


I am trying to figure out why XCode cannot resolve a C++ file I imported.

  • I have changed the file extension to .mm
  • I have added the .h file contents to the top of my file
  • I have command line tools installed

The code complete detects the algorithm library:

Code Complete Works

But when I try compile I get this:

Not working


Solution

  • Ok I found the issue.

    As it turns out you need to not only use the .mm extension to invoke the objective-c++ compiler, but also anything that REFERENCES the .mm too. So I had a view controller that referenced the c++ header.