开发者

iOS help: math.h? Where is this?

I am following a tutorial out of a book and in the .h file of where some of my code is, I have to type in: #import . Where is this file located? Is it part of some framework or do I have to d开发者_Python百科ownload it somewhere? I've googled this and found a question about math.h on MacRumors, so I know that it has something to do with iOS programming and probably isn't specific to the book.


It's part of the SDK that you have already installed if you are doing iOS development. All you need to do is put the line

#import <math.h>

in your code. You don't need to download anything. You don't need to link against anything (the math library, libm, is part of libSystem on both iOS and OS X, and is linked by default).

Note that this has nothing to do with "iOS programming". <math.h> is part of the C standard library, not specific to any platform.

Have you tried this? Did you encounter a problem?


Well, it depends. In the tutorial you're following, if it imports that header like so:

#import "math.h"

That means it is in the user header search path. In other words, it's not a system library, but something the author created. If that is the case, you'll have to find it online, or maybe in the back of the book you're reading.

If the library instead appears like this:

#import <accelerate/math.h>

Then it's a system library(note the '< >' instead of quotes), in the accelerate framework (just an example, I don't know if there is a math.h in accelerate or not). The first part of the path of the import indicates the framework you'll find the header in.

If you change your question to include the full #import statement in the book, I can more accurately help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜