This is the error description:
Code: Select all
error 1: make:*** [Bluetooth Server 2]Error 1 Resource: Bluetooth Server 2
error 2: recipe for target 'Bluetooth Server 2' failed Resource: makefile Path: /Bluetooth Server 2/Debug Location: line 45
where "Bluetooth Server 2" is the name of the project
Code: Select all
#include "/usr/include/stdint.h"
#include "/usr/include/bluez-5.31/lib/bluetooth.h"
#include "/usr/include/bluez-5.31/lib/hci.h"
#include "/usr/include/bluez-5.31/lib/hci_lib.h"
#include "/usr/include/bluez-5.31/lib/rfcomm.h"
int main(int argc, char **argv)
{
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
char buf[1024] = { 0 };
int s, client, bytes_read;
unsigned int opt = sizeof(rem_addr);
//allocate socket
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
//bind socket to port 1 of the first available adapter
bdaddr_t tmp = {0,0,0,0,0,0};
loc_addr.rc_family = AF_BLUETOOTH;
loc_addr.rc_bdaddr = tmp;
loc_addr.rc_channel = 1;
bind(s, (struct sockaddr* )&loc_addr, sizeof(loc_addr));
//put socket into listening mode
listen(s, 1);
//accept one connection
client = accept(s, (struct sockaddr *)&rem_addr, &opt);
ba2str( &rem_addr.rc_bdaddr, buf );
fprintf( stderr, "accepter connection from %s\n", buf);
memset( buf, 0, sizeof(buf));
//read data from the client
bytes_read = recv(client, buf, sizeof(buf), 0);
if( bytes_read > 0 )
{
printf("received [%s]\n", buf);
}
//close connection
//close(client);
//close(s);
return 0;
}
Code: Select all
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: Bluetooth\ Server\ 2
# Tool invocations
Bluetooth\ Server\ 2: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -L/usr/include/ -bluez-5.31 -o "Bluetooth Server 2" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) "Bluetooth Server 2"
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
Code: Select all
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Miscellaneous: In the linker flags box i wrote: "-bluez-5.31"
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Libraries: Added " "bluez-5.31" " in -l
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Libraries: Added " /usr/include " in -L