How are you? Well, I need you help, please. I'm trying create a aplication Server/Client into two PCs,
using mode Bluetooth, with C ANSI in Windows XP. I use the compiler MinGW.

I show you my code, It's very simple. Only I try create a SOCKET, this I used the help of MSDN Library

// --------------------------------
#include <stdio.h>
#include <winsock.h>

int main(int argc, char **argv) {
    WSADATA wsaData;
    int iResult = WSAStartup(MAKEWORD(1, 1), &wsaData);
    if (iResult == NO_ERROR) {
    SOCKET connectSocket;
    connectSocket = socket(AF_BTH,
    if (connectSocket == INVALID_SOCKET) {
    return 0;
// --------------------------------

well, when I compiled the above code:

# -----------makefile----------------
CC = gcc
all: Server.exe
Server.exe: Server.o
    $(CC) -o Server.exe Server.o -lwsock32    
Server.o: Server.c
    $(CC) -c Server.c
# -----------------------------------

It show me follow errors:

% -----------------------------------
Server.c: In function `main':
Server.c:20: error: `AF_BTH' undeclared (first use in this function)
Server.c:20: error: (Each undeclared identifier is reported only once
Server.c:20: error: for each function it appears in.)
Server.c:22: error: `BTHPROTO_RFCOMM' undeclared (first use in this function)
mingw32-make: *** [Server.o] Error 1
% -----------------------------------

I don'n know why happen this. In the reference of MSDN, say:


Bluetooth is an industry-standard protocol that enables wireless connectivity for computers, handheld devices, mobile phones, and other devices.

Where Applicable

The Bluetooth application programming interface enables developers to use existing network programming knowledge to quickly develop or port applications.

Developer Audience

Bluetooth is designed for use by C/C++ programmers. Some Bluetooth features are available with Windows Sockets. Familiarity with Microsoft Windows networking and Windows Sockets programming is required.

Run-Time Requirements

Microsoft supports Bluetooth on Windows XP SP1 and later.

So, why this errors? I need any other library?

In advance, thank you....

Excuse me my spelling...