Errors Building

Discussion in 'C++' started by dkaksl, Jun 5, 2011.

  1. dkaksl

    dkaksl Guest

    I'm currently using Eclipse to build and transfer software to an nxtOSEK robot. When trying to build a sample program, I get a few warnings and errors.

    Code:
    sample.c:90: warning: pointer targets in passing argument 1 of [ecrobot_set_bt_device_name] differ in signedness
    sample.c:225: error: implicit declaration of function [ecrobot_read_bt]
    sample.c:233: error: implicit declaration of function [ecrobot_send_bt] make: *** [build/sample.o] Error 1
    My knowledge of programming is still very limited so I'm not really sure what to look for or add when I get these prompts. Anyways, the lines specified are as follows:

    Code:
    ecrobot_set_bt_device_name(DEVICE_NAME);
    and
    Code:
    char rx_buf[BT_MAX_RX_BUF_SIZE];
    Also, what does the 90, 255 and 233 mean? I'm sure it's not the line number in the source code, because the char rx_buf part comes way before the other part.

    Any and all help appreciated. Also, if you need me to post more information, I'll do my best there. :)
     
  2. DRK

    DRK New Member

    Joined:
    Apr 13, 2012
    Messages:
    44
    Likes Received:
    3
    Trophy Points:
    0
    Compiler is warning you that you are passing pointer to signed value when pointer to unsigned value is needed (or vice versa).
    You probably defined DEVICE_NAME like this
    Code:
    #define DEVICE_NAME "SomeName"
    or
    Code:
    char *DEVICE_NAME = "SomeName";
    but the function prototype is
    Code:
    U8 ecrobot_set_bt_device_name(CHAR* bd_name);
    There are 3 ways to fix it (just one of them should suffice):

    1. Change the type of DEVICE_NAME
    Code:
    CHAR *DEVICE_NAME = "SomeName";
    2. Include this file
    Code:
    #include <ecrobot_types.h>
    3. Call the function with typecast
    Code:
    ecrobot_set_bt_device_name((CHAR*) DEVICE_NAME);


    You have mistaken, these are line numbers, because the error messages clearly refer to functions, not an array declaration.
    Errors are caused by missing function prototypes, you have to include this header file at the top of your sample.c
    Code:
    #include <ecrobot_bluetooth.h>
     
  3. dkaksl

    dkaksl Guest

    Thanks, I tried making the changes you suggested when I realized I completely missed the first error in the console. Sorry to be so misleading. Anyways, here's the error:

    Code:
    error: [BT_MAX_RX_BUF_SIZE] undeclared here (not in a function)
     
  4. DRK

    DRK New Member

    Joined:
    Apr 13, 2012
    Messages:
    44
    Likes Received:
    3
    Trophy Points:
    0
    BT_MAX_RX_BUF_SIZE is a macro defined in ecrobot_bluetooth.h header file - include it, just like I showed you in the previous post.
     
  5. dkaksl

    dkaksl Guest

    I tried that, but it just told me it was a file that didn't exist. Am I supposed to have that header file?
     
  6. DRK

    DRK New Member

    Joined:
    Apr 13, 2012
    Messages:
    44
    Likes Received:
    3
    Trophy Points:
    0
    Was it a message on the compiler's console or just an info at line where #include is (yellow underline)? Maybe both?

    Look up for this file in your nxtOSEK directory, it should be in nxtOSEK\ecrobot\c. If it's there, you have to add this path to your Eclipse project's Makefile.

    Have you read it? http://lejos-osek.sourceforge.net/eclipse.htm
     
  7. dkaksl

    dkaksl Guest

    Awesome! Ok, so I included the header file (which conveniently cleared up the warnings), but it didn't say anything about MAX_RX buf size, so I changed the BT_BUF_SIZE to BT_MAX_RX_BUF_SIZE. Now it gives me the error BT_BUF_SIZE is undeclared. I guess I have to define both?

    It's especially confusing as the comment says it's the maximum size of Bluetooth Tx/Rx buffer:

    Code:
    #define BT_BUF_SIZE 254 /* maximum size of Bluetooth Tx/Rx buffer in byte */
    This is just confusing.
     
  8. dkaksl

    dkaksl Guest

    I also noticed something weird trying to include Bluetooth.h listed in ecrobot/c++/device/. In cygwin, it's visible in the Project Explorer, but the folder doesn't exist on my system.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice