Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When make get error:‘isnan’ was not declared in this scope #15111

Closed
icecity96 opened this issue Feb 25, 2016 · 6 comments
Closed

When make get error:‘isnan’ was not declared in this scope #15111

icecity96 opened this issue Feb 25, 2016 · 6 comments
Assignees
Milestone

Comments

@icecity96
Copy link

When I make I got the following error:

/opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:197:22: error: ‘isnan’ was not declared in this scope
     if( isnan(_angleX) )
                      ^
/opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:197:22: note: suggested alternative:
In file included from /usr/include/c++/5.3.0/random:38:0,
                 from /opt/cocos2d-x/cocos/base/ccRandom.h:29,
                 from /opt/cocos2d-x/cocos/base/ccMacros.h:73,
                 from /opt/cocos2d-x/cocos/math/CCGeometry.h:32,
                 from /opt/cocos2d-x/cocos/2d/CCAction.h:32,
                 from /opt/cocos2d-x/cocos/2d/CCActionInterval.h:33,
                 from /opt/cocos2d-x/cocos/2d/CCActionCamera.h:31,
                 from /opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:28:
/usr/include/c++/5.3.0/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
cocos/CMakeFiles/cocos2d.dir/build.make:86: recipe for target 'cocos/CMakeFiles/cocos2d.dir/2d/CCActionCamera.cpp.o' failed
make[2]: *** [cocos/CMakeFiles/cocos2d.dir/2d/CCActionCamera.cpp.o] Error 1
CMakeFiles/Makefile2:419: recipe for target 'cocos/CMakeFiles/cocos2d.dir/all' failed
make[1]: *** [cocos/CMakeFiles/cocos2d.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

OS:Arch linux
Compiler: GNU 5.3.0

@icecity96
Copy link
Author

I have solved this problem,just using std::isnan repalce isnan...
see here

@Lechindianer
Copy link

Same problem occurs here with the same architecture. It would be great if this fix would get merged into master. @icecity96: Could you please reopen the issue to fix this issue for all? :)

The isnan <-> std::isnan problem exists in 2 files: cocos/2d/CCActionCamera.cpp and extensions/GUI/CCControlExtension/CCControlUtils.cpp

@icecity96
Copy link
Author

I really want to fix it.But if I just simply using std::isnan replace isnan will cause some problem on windows(window doesn't have std::isnan,just isnan).So If you use linux, the following command might help you.

$ cd cocos2d-x
$ sed -i 's/isnan/std::isnan/g' `grep "isnan" -rl`

And I think this could be written in CMakefile in some way(I hope, I am not very familiar with CMake) @Lechindianer

@icecity96 icecity96 reopened this Mar 16, 2016
@minggo minggo self-assigned this Apr 27, 2016
@minggo
Copy link
Contributor

minggo commented Apr 27, 2016

Cocos2d-x will only test on Ubuntu, but we accept PR that fix the issue and will not affect other platforms.

@gelldur
Copy link
Contributor

gelldur commented Apr 27, 2016

@minggo PR :)

ok not working on windows beacuse of:

cocos/platform/winrt/CCStdC.h:49: #define isnan _isnan

@minggo
Copy link
Contributor

minggo commented May 5, 2016

fixed in #15569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants