Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: identifier "MAXFLOAT" is undefined

I am trying to convert a Xcode project (link) to a VS2008 solution.

In a cuda filetype .cu, the term MAXFLOAT is used. I am adding the following headers but the error is not resolved.

#include <stdio.h>
#include <math.h>

In the Xcode project, I tried to locate the definition but there is none. Also this term is only used in this file. Is this something specific to Xcode?

like image 707
Abdur Rahman Avatar asked Oct 17 '25 18:10

Abdur Rahman


1 Answers

MAXFLOAT is a non-standard parameter. Use one of the following, portable alternatives:

  • In C: use the standard library FLT_MAX (defined in <float.h>).

  • In C++: use std::numeric_limits<float>::max (defined in <limits>). You may still use C's FLT_MAX, but include <cfloat> instead.

like image 149
2 revs, 2 users 67%talonmies Avatar answered Oct 20 '25 18:10

2 revs, 2 users 67%talonmies