1

I have been trying to set up FLTK in xCode. After a little struggling I thought I was successful in linking all the libraries, etc... However, I am now getting the following error from the math.h file located in the FL/include folder:

'/usr/include/math.h'file not found

from the following code:

// Xcode on OS X includes files by recursing down into directories.
// This code catches the cycle and directly includes the required file.

#ifdef fl_math_h_cyclic_include 
#  include "/usr/include/math.h"
#endif

I have read through a few different solutions posted before, but none of them are seeming to work for me. There is no file math.h located in that directory. Thanks in advance for the help!

mjfish93
  • 95
  • 8

2 Answers2

1

I had this same problem trying to use FLTK .lib files in Visual Studio 2015 Community. After a bit of searching, this Stackoverflow page gave me the right hint:

Resolving LNK4098: defaultlib 'MSVCRT' conflicts with

The mistake I was making is that I built the FLTK .lib files myself a long time ago and forgot what setting I used.

In my new Project for which FLTK was needed, I needed the following settings in VS2015(that was forced by another library I wanted to use together with FLTK):
Project Properties -> C/C++ -> Runtime Library I needed Multi-threaded Debug (/MTd)

It turned out that I built the FLTK .libs a year before using

Multi-threaded Debug DLL (/MDd)
instead of
Multi-threaded Debug (/MTd)

I did two things: Rebuilt the FLTK libraries in VS2015 with the correct settings and

in the FL folder in FLTK, I renamed the math.h file to Fl_math.h

Which solved the problem.

pytton
  • 11
  • 2
0

I had a similar problem on Linux. The way I got around it was

  1. In the FL directory, rename math.h to Fl_math.h
  2. In all the files that #include FL/math.h change to FL/Fl_math.h

The base problem is that constants like M_E are not defined by default so Fl_math.h defines them. On the Linux/MS environment, all Fl_math.h needs to do is

#define _USE_MATH_DEFINES
#include <cmath>

The Xcode environment might be the same.

cup
  • 7,589
  • 4
  • 19
  • 42