usr/include/math.h: No such file or directory??

1,169 views
Skip to first unread message

Svets

unread,
Jun 7, 2016, 7:28:10 AM6/7/16
to fltk.general
I'm getting the error  usr/include/math.h: No such file or directory compiling my small FLTK project on Windows 7 with a GCC compiler 4.81.

I know why this is happening but I can't work out how to fix it. 

I have included the below which is causing the error.

#include <math.h> 

This is in C++ so I want the C++ header not the FLTK one.  

I've tried specifically including it with the below path but still no cocktail.  I keep getting the above error. 

#include "C://mingw//lib//gcc//x86_64-w64-mingw32//5.1.0//include//c++//tr1//math.h"

Does anyone know a way around this?

Thanks

David Topham

unread,
Jun 7, 2016, 7:08:01 PM6/7/16
to fltk.general
It would seem to me that you want  
#include <cmath>
then if needed, add  std:: in front of whatever math routine your are calling.

math.h is deprecated for c++ 

Martin McDonough

unread,
Jun 7, 2016, 8:03:19 PM6/7/16
to fltk.general
You should still be able to use the non-std namespaced versions of functions while including cmath

Greg Ercolano

unread,
Jun 7, 2016, 8:58:23 PM6/7/16
to fltkg...@googlegroups.com
On 06/07/16 04:28, Svets wrote:
> I've tried specifically including it with the below path but still no cocktail. I keep getting the above error.
> #include "C://mingw//lib//gcc//x86_64-w64-mingw32//5.1.0//include//c++//tr1//math.h"

Try replacing the // with just / throughout that entire path, e.g.

#include "C:/mingw/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/tr1/math.h"

The doubling of slashes is /only/ the right to do
if using *back slashes*.

Not the case for fronts.


David Topham

unread,
Jun 8, 2016, 6:04:59 PM6/8/16
to fltk.general, erco_...@seriss.com
Would it be also better to use a compiler flag like:

-I C:/mingw/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/tr1/

...rather than "hardcoding" a path in an include statement?  To make it more portable? 

Greg Ercolano

unread,
Jun 9, 2016, 1:06:10 AM6/9/16
to fltkg...@googlegroups.com
On 06/08/16 15:04, David Topham wrote:
> Would it be also better to use a compiler flag like:
>
> -I C:/mingw/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/tr1/
>
> ...rather than "hardcoding" a path in an include statement? To make it more portable?

Yes, I assume the path you were putting in the code
was just for testing.

Certainly you'd want to not have a full path like that in
the code, and you'd want <>'s instead of "".

Thing is, typically the compiler should know where to find
its own include files, so it's kinda weird you have to tell
it where to look with -I to find compiler include files.

Might be something wrong with your compiler environment there,
not sure.

Reply all
Reply to author
Forward
0 new messages