Question: I'm trying to compile code from a backtrace project <https://code.google.com/p/backtrace-mingw/> which is written for MinGW, but using MinGW-w64.

My old install and fresh install of MinGW-w64 produce the same problem. Path is set in path variables, and also in command prompt: 

*C:\mingw-w64\i686-4.9.2-win32-sjlj-rt\_v3-rev1\mingw32\bin* 

and *C:\mingw-w64\i686-4.9.2-win32-sjlj-rt\_v3-rev1\mingw32* although this one isn't needed.

This is the makefile of that project:

```
.PHONY: all clean

all : backtrace.dll test.exe

backtrace.dll : backtrace.c
    gcc -O2 -shared -Wall -o $@ $^ -lbfd -lintl -liberty -limagehlp

test.exe : test.c
    gcc -g -Wall -o $@ $^

clean :
    -del -f backtrace.dll test.exe

```

When compiling I get the warning: 

*backtrace.c:23:17: fatal error: bfd.h: No such file or directory #include < bfd.h>`*

Which is weird because that file exists in *../mingw32/include* folder.

If I add this when compilind the dll: *-IC:\mingw-w64\i686-4.9.2-win32-sjlj-rt\_v3-rev1\mingw32\include* it continues but stops at the directive: *#error config.h must be included before this header* and config.h is missing in MinGW-w64

Any ideas?

Answer: 
That path is definetely missing from gcc include paths in mingw. I don't know why. You have to add it yourself in any way you like: cmake recipe, autoconf recipe, [CFLAGS](https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html), [CPATH](https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html), [gcc specs](http://www.mingw.org/wiki/SpecsFileHOWTO).

And, as far as I remember, it uses only `HAVE_STRINGIZE` macro from `config.h` and it is used only to define `CONCAT4` macro, that's not used anywhere in `bfd.h`. So, it's safe to cheat a little and put

`#define PACKAGE package`

before including `bfd.h`
add this to the end of the compile statement:

```
-I./mingw32/include

```

so the whole compile statement would be:

```
gcc -g -Wall -o $@ $^ -I./mingw32/include

```

so the compiler knows where to find the include files