'cmath' file not found

Original link: http://www.cnblogs.com/yang3wei/archive/2012/02/28/2739458.html

and cocos2d box2d of b2Vec2 type of CGPoint, CGSize, CGRect, I want to take out their own use,

So we created a new Terminal project.

Because CGPoint and Apple's own CoreGraphics which comes ~

The box2d inside b2Vec2 type I often use,

B2Math.h header file which contains b2Vec2 type definition also contains a lot of useful thread method,

So I would like to re-use these ready-made things.

But we encountered some problems:

‘cmatch’ file no found, 'iostream' not recognized等等,

It included in the b2Math.h

#include <cmath>

#include <cfloat>

#include <cstddef>

#include <cassert>

#include <limits>

And other pre-compiler directives, even each one has a problem, it can not properly introduced!

Later I found a post:

C++ #include help?

Quote:
Originally Posted by  BlackBlade  View Post
cmath related errors are simply this, "cmath" file not found, and iostream is not recognized, i then went through the whole list of include functions(not sure what to call them) and the closest thing on there is IOsurface or IOsurface.h
Did you create a C++ project and not Objective-C or Cocoa? I you pick a Cocoa application you will get this error.



Quote:
Originally Posted by  subsonix  View Post
Did you create a C++ project and not Objective-C or Cocoa? I you pick a Cocoa application you will get this error.
i am an idiot, i figured it out, i never made a file in the project i simply used main.m
just tried making a c++ file and it worked

thanks a lot, now i won't fail! thanks again


According to the relevant information posts which mentioned, in the future I will main.m into main.mm file, compiled successfully by ~


Reproduced in: https: //www.cnblogs.com/yang3wei/archive/2012/02/28/2739458.html

Guess you like

Origin blog.csdn.net/weixin_30257433/article/details/94782756