Search code examples
c++xcodeobjective-c++

Xcode and Objective-C++ can't find <cstdio>


I'm writing Cocoa code that uses some classes defined in a C++ library. I give the filename the extension .mm, and things are usually fine.

But not always. Sometimes Xcode 4 disappoints me with: "Lexical or Preprocessor issue: 'cstdio' not found". I can't figure out how to make Xcode find it. Nor can I figure out why it works sometimes, but not others. What do you think?

Edit: Noise. My filename extension was not .mm, but rather .m. :( There is not, and there never was, a problem. See below.


Solution

  • It still should be able to find <stdio.h> just fine.

    Edit: The .mm file should work fine all the time. Make sure in your build settings that Compile Source As is set to According to File Type