> Here's the path of the actual math file I'm looking for.
> C:\mingw\lib\gcc\x86_64-w64-mingw32\5.1.0\include\c++\tr1\math.h
No; I really do not think that it is - you should be calling the top-level "system" math.h, never the implementation specific parts.
The top-level math.h should be there to make sure that the "correct" math.h parts are included for the current build config; e.g. if you have multiple compiler personalities for different cross-compilers and so forth.
You should have a file in "/mingw/include/math.h", and that should be the one the compiler finds first.
From there, the compiler may then decide to include various other "math.h" parts from around the installation to pick up all the bits it needs for the current compilation, but you should not need to know the details for that, the compiler should be doing that "right".
You just need to call the "system" math.h and let the tools sort out what they need.
You should not be calling the specific low-level implementation parts.
> but I believe the below path is also searched by default by my mingw
> compiler.
> c:/mingw/include
Are you running from the Msys environment? Is it working right?
For me, all the "system" headers appear at "/mingw/include" (note that there is NO leading drive letter there) and it all Just Works.
From an Msys shell, I do:-
$ ls /mingw/include/math.h
/mingw/include/math.h
That is the file your compiler should be finding.
You can see some of where the compiler tries to look by passing "-v" to gcc when it compiles a file; you get chatter like this:-
$ gcc -v win_version.c -o test.exe
Using built-in specs.
COLLECT_GCC=D:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=d:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-o' 'test.exe' '-mtune=generic' '-march=pentiumpro'
d:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1.exe -quiet -v -iprefix d:\mingw\bin\../lib/gcc/mingw32/4.8.1/ win_version.c -quiet -dumpbase win_version.c -mtune=generic -march=pentiumpro -auxbase win_version -version -o C:\Users\IAN~1.MAC\AppData\Local\Temp\ccs65yWG.s
GNU C (GCC) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "d:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include"
ignoring duplicate directory "d:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../include"
ignoring duplicate directory "/mingw/include"
ignoring duplicate directory "d:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include-fixed"
ignoring duplicate directory "d:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
d:\mingw\bin\../lib/gcc/mingw32/4.8.1/include
d:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../include
d:\mingw\bin\../lib/gcc/mingw32/4.8.1/include-fixed
d:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../mingw32/include
End of search list.
GNU C (GCC) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 767202a405449496e68a54c4eee91a28
COLLECT_GCC_OPTIONS='-v' '-o' 'test.exe' '-mtune=generic' '-march=pentiumpro'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/as.exe -v -o C:\Users\IAN~1.MAC\AppData\Local\Temp\ccLgDxdk.o C:\Users\IAN~1.MAC\AppData\Local\Temp\ccs65yWG.s
GNU assembler version 2.24 (mingw32) using BFD version (GNU Binutils) 2.24
COMPILER_PATH=d:/mingw/bin/../libexec/gcc/mingw32/4.8.1/;d:/mingw/bin/../libexec/gcc/;d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/
LIBRARY_PATH=d:/mingw/bin/../lib/gcc/mingw32/4.8.1/;d:/mingw/bin/../lib/gcc/;d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/;d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'test.exe' '-mtune=generic' '-march=pentiumpro'
d:/mingw/bin/../libexec/gcc/mingw32/4.8.1/collect2.exe -Bdynamic -o test.exe d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../crt2.o d:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtbegin.o -Ld:/mingw/bin/../lib/gcc/mingw32/4.8.1 -Ld:/mingw/bin/../lib/gcc -Ld:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib -Ld:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../.. C:\Users\IAN~1.MAC\AppData\Local\Temp\ccLgDxdk.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt d:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.o
From this, you can see the directories the compiler is looking in to find what it needs.
Your "system" headers should be found in these paths; if they are not, you need to figure out why not and make sure they are installed correctly!
> So I'm guessing from this I shouldn't have installed my compiler on the
> same path as my build environment. Would that be right?
I don't think that is the issue here. This should work.
> I always have trouble with these things but if this is right then it
> will help allot.
> The reason I say this is because there is a math.h file in
> c:/mingw/include/FL/math.h
But that should not matter. If you ask for:-
#include <math.h> // note angle brackets, not quote marks //
Then it should always find "/mingw/include/math.h" before it finds "/mingw/include/FL/math.h", since the first folder is above the second; and there ought to be no problem.