[mingw] Simple application crashes

Hi there,
Let the following code be a simple useless application:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
extern "C" {
#include "windows.h"
#include "./ddk/hidsdi.h"
#include "setupapi.h"
}


int main()
{
	GUID hid_guid;
	HidD_GetHidGuid(&hid_guid);

	std::cerr << "Success" << std::endl;
}


To build this code I used gcc included in mingw. As a preface I had to download Windows DDK since hid.lib and setupapi.lib aren't included in mingw. The compiler actually uses headers from the mingw inc directory since the ones from the windows DDK are, afaik, intended to be used with MSVCPP.
The program gets compiled without any either error or warning, but it doesn't work.
The control never manages to reach the line that outputs on std::cerr since no message is being output while executing, furthermore the application crashes and windows pops the classic [Send error report, Do not Send] error window.
I'm pretty useless in windows programming, any suggestion or advice would be really appreciated.


EDIT: I tried to build the same program by compiling it with gcc instead of g++ ( obviously replacing the cpp streams with printf ) and it works just fine... I don't see the point :(
Last edited on
MINGW does come with the DDK headers and libs.
Removed DDK search path, works just fine with the built-in libs, thanks for pointing that out!!

BTW: This makes me think M$ libs are incompatible with MinGW, is that true?
They are incompatible - that is to say they are different formats. They are also named differently.
You will notice that the mingw (which is a windows port of G++) libraries are called libxxx.a and microsoft libraries are xxx.lib
Topic archived. No new replies allowed.