I have quite simple task to compile working code for bluetooth socket.
I have:
QtCreator 4.7.0, mingw, Windows Platform SDK 2003, - WindowsXP
The code for Bluetooth API strarting with:
#include <bthsdpdef.h>
#include <BluetoothAPIs.h>
#include <winsock2.h>
#include <ws2bth.h>
void Run( )
{
WORD wVersionRequested = 0x202;
WSADATA m_data;
if (0 == ::WSAStartup(wVersionRequested, &m_data))
{
SOCKET s = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
const DWORD lastError = ::GetLastError();
if (s == INVALID_SOCKET)
{
....
etc...
#include <bthsdpdef.h>
#include <BluetoothAPIs.h>
#include <winsock2.h>
#include <ws2bth.h>
void Run( )
{
WORD wVersionRequested = 0x202;
WSADATA m_data;
if (0 == ::WSAStartup(wVersionRequested, &m_data))
{
SOCKET s = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
const DWORD lastError = ::GetLastError();
if (s == INVALID_SOCKET)
{
....
etc...
To copy to clipboard, switch view to plain text mode
In .pro file I'm writing:
INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include"
INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include"
To copy to clipboard, switch view to plain text mode
Error:
..\..\Program Files\Microsoft Platform SDK\Include/winnt.h:666:2: error: #error Must define a target architecture.
..\..\Program Files\Microsoft Platform SDK\Include/bthsdpdef.h:16: error: 'ULONGLONG' does not name a type
..\..\Program Files\Microsoft Platform SDK\Include/bthsdpdef.h:29: error: 'USHORT' does not name a type
... etc 500 errors..
Adding to .pro file extra include folder:
INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include" "C:\\Program Files\\Microsoft Platform SDK\\Include\\crt"
INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include" "C:\\Program Files\\Microsoft Platform SDK\\Include\\crt"
To copy to clipboard, switch view to plain text mode
Then I'm getting another erros:
..\..\Program Files\Microsoft Platform SDK\Include\crt/stddef.h:119: error: redeclaration of C++ built-in type 'wchar_t'
..\..\Program Files\Microsoft Platform SDK\Include\crt/stdlib.h:258: error: expected constructor, destructor, or type conversion before '_abs64'
..\..\Program Files\Microsoft Platform SDK\Include\crt/stdlib.h:267: error: expected initializer before '_byteswap_uint64'
... etc.. 500 other similar erros
The question:
How to compile 3rd party (windows api) stuff with QtCreator and mingw compiler?
Am I missing something? Is it possible with mingw at all or better to use msvc compiler?
Bookmarks