It might be hard to believe but I still struggle to completely understand what a build environment is. I have gathered over the years that it is a directory tree within which my compiler can find all the necessary headers and lib files to build my projects.. I never really learned this concept properly and gained a basic understanding of it only recently.
I'm using a TDM-GCC 64bit compiler, MSYS, Windows 7 64bit.
When I build my libraries for use in my projects they all place header and lib files into my C:\mingw directory.. ie.. C**:\mingw\include & C:\mingw\lib**
Let's say I'm building zlib. The zlib directory will contain both the lib and include headers and my root c:\mingw directory will also contain the zlib headers and lib files in these directories the c:\mingw\include & c:\mingw\lib directory.
So when I'm building other libraries that need zlib as a dependancey, I initially used the below command: ./configure --prefix = c:\mingw and when I build it using the 'make' command (all in MSYS), my new library can find all it's dependencies in the c:\mingw\include & c:\mingw\lib directory. Have I done this correctly?
Here's where I get confused. When I am writing up my projects in my CodeBlocks IDE which uses the same compiler TDM-GCC 64bit, do I set the search directories to the c:\mingw\include & c:\mingw\lib directories or do I use the zlib directory c:\zlib\include and c:\zlib\lib directory?
Or..... Should I have placed the entire zlib directory inside the c:\mingw directory so that my file path looks like this:
c:\mingw\zlib\include & c:\mingw\zlib\lib directories.
If I'm wrong about all of the above, how do I set up a robust build environment on windows?
Also.... to supplement this gap in my knowledge, is there any book/textbook which explains this kind of thing well?
I have decided against using cygwin for now.
Lots of questions ;)
Thanks, sorry for the long spiel.
*******Late addition below*************
I placed a test file in c:\ming and using my cmd line I called the command gcc -v test.h (test.h is the test file I placed in my root directory to test the search path of my compiler. Here's the output:
As you can see, when using --prefix, the other include directory at: C:/mingw/lib/gcc/x86_64-w64-mingw32/5.1.0/include is ignored. I'm wondering why the mingw compiler has done this.
The file I'm having trouble getting my compiler to search for (math.h) is not even in the include directory.
C:\mingw\include>gcc -v test.h
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
C:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/cc1.exe -quiet -v -iprefix C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/ -D_REENTRANT test.h -quiet -dumpbase test.h -mtune=generic -march=x86-64 -auxbase test -version -o C:\Users\user\AppData\Local\Temp\cco9AQmC.s --output-pch=test.h.gch
GNU C11 (tdm64-1) version 5.1.0 (x86_64-w64-mingw32)
compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.1.0/include"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../include"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.1.0/include-fixed"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/include
C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../include
C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/include-fixed
C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C11 (tdm64-1) version 5.1.0 (x86_64-w64-mingw32)
compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 72fdcf42c4c1c584c8e1347f320364c3
In file included from pngconf.h:30:0,
from test.h:422:
C:/mingw/include/limits.h:32:23: fatal error: tr1/climits: No such file or directory
compilation terminated.
C:\mingw\include>