Eclipse生成文件错误

Eclipse生成文件错误,eclipse,makefile,Eclipse,Makefile,我需要一些帮助来解决一个错误。我试图使用bluez-5.31库创建一个简单的蓝牙服务器。我在Raspbian Jessie上使用eclipse,这类似于Debian,但我对这两种方法几乎没有经验。我已经试着修好几天了,但似乎什么都没用,所以我真的需要一些帮助。。。 以下是错误描述: error 1: make:*** [Bluetooth Server 2]Error 1 Resource: Bluetooth Server 2 error 2

我需要一些帮助来解决一个错误。我试图使用bluez-5.31库创建一个简单的蓝牙服务器。我在Raspbian Jessie上使用eclipse,这类似于Debian,但我对这两种方法几乎没有经验。我已经试着修好几天了,但似乎什么都没用,所以我真的需要一些帮助。。。 以下是错误描述:

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]
这主要是:

#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;
}
这是make文件: -包括../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_U    PPER_DEPS) "Bluetooth Server 2"
    -@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets
这就是我对项目属性所做的更改:

- 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

在这些错误出现之前是否会出现一些编译器错误消息?不要在标识符或名称中使用空格,甚至不要在文件名中使用空格。这使得使用它们非常困难,例如,您必须在Makefile目标名称中转义它们。手工编写Makefile并使用简单的文本编辑器似乎非常简单。除非它真的有用,否则不要使用像eclipse这样复杂的IDE。在小项目中使用geany和Makefiles,您将了解到它是如何工作的,并且您将对获得的简单性非常满意。此外,eclipse是一个非常复杂的IDE,没有其他错误。只有这两个项目出现了。事实证明,项目名称中的空白是问题所在。创建了一个没有任何空格的新项目,并且错误不再存在。在这些错误出现之前是否出现了一些编译器错误消息?不要在标识符或名称,甚至文件名中使用空格。这使得使用它们非常困难,例如,您必须在Makefile目标名称中转义它们。手工编写Makefile并使用简单的文本编辑器似乎非常简单。除非它真的有用,否则不要使用像eclipse这样复杂的IDE。在小项目中使用geany和Makefiles,您将了解到它是如何工作的,并且您将对获得的简单性非常满意。此外,eclipse是一个非常复杂的IDE,没有其他错误。只有这两个项目出现了。事实证明,项目名称中的空白是问题所在。制作了一个新项目,没有任何空白,错误也不再存在。