I am getting the following error when trying to build my project using XCode 5.
Use of undeclared identifier 'FLT_EPSILON'
I have checked, and FLT_EPSILON (it shows up brown in Xcode), is defined in the "float.h" file.
What am I doing wrong?
This is the code where FLT_EPSILON is used:
if (someTimeInterval < 0.03 - FLT_EPSILON) {
someTimeInterval = 0.1;
}
I figured out that this was occurring because I was trying to test it out on the iPhone 5S simulator (64 BIT).
I don't understand too well the differences when using the 64 bit simulator. What should I include instead of FLT_EPSILON - and why doesn't it work with 64 bits?
The solution is to disable modules in your project. To do this, go to build settings and set "Enable Modules" to "No".
That's a clang
bug. Modules (-fmodules
flag) are still experimental feature and when you mix Objective-C and C/C++ modules there can be some bugs.
See my demo project at github: TestEpsilon
First target use modules, the second one no. To ensure we got "clean" build I added DerivedData
and ModulesCache
cleanup in pre-build scripts.
This worked for me:
#ifndef FLT_EPSILON
#define FLT_EPSILON __FLT_EPSILON__
#endif
(this is how it's defined in float.h
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With