0

I am getting a declaration is incompatible error even if the definitions and declarations of the said functions are the same. Here are the error message below from TI Code Composer Studio after build. Any ideas what could be causing these errors?

Error Message:

'#148 declaration is incompatible with "int32_t exoPal_atoi(char *)" (declared at line 65 of "C:\EK-TM4C129\exosite\exosite_pal.h") exosite_pal.c   /getting_started_with_wlan_station_exosite_write/exosite    line 509    C/C++ Problem
'#148 declaration is incompatible with "int32_t exoPal_sendingComplete()" (declared at line 62 of "C:\EK-TM4C129\exosite\exosite_pal.h")    exosite_pal.c   /getting_started_with_wlan_station_exosite_write/exosite    line 260    C/C++ Problem

c function declarations at exosite_pal.h

#ifndef EXOSITE_HAL_H
#define EXOSITE_HAL_H
#include <stdint.h>


/*!< This defines the size of the rx buffer in the PAL.  This buffer is used
   to place incoming data from the modem in.*/
#define RX_BUFFER_SIZE                         512

extern char exoPal_rxBuffer[RX_BUFFER_SIZE];

// defines


// functions for export
void exoPal_init();
uint8_t exoPal_setCik(const char * read_buffer);
uint8_t exoPal_getCik(char * read_buffer);
uint8_t exoPal_getModel(char * read_buffer);
uint8_t exoPal_getVendor(char * read_buffer);
uint8_t exoPal_getUuid(char * read_buffer);

uint8_t exoPal_tcpSocketClose();
uint8_t exoPal_tcpSocketOpen();
uint8_t exoPal_socketRead( char * buffer, uint16_t bufSize, uint16_t * responseLength);
uint8_t exoPal_socketWrite( const char * buffer, uint16_t len);
int32_t exoPal_sendingComplete( );

uint8_t exoPal_itoa(int value, char* str, uint8_t radix);
int32_t exoPal_atoi(char* val);
uint16_t exoPal_strlen(const char *s);
uint8_t exoPal_memcpy(char * dst, const char * src, uint16_t length);
char* exoPal_strstr(const char *in, const char *str);


#endif

c function definitions at exosite_pal.c

#include "exosite_pal.h"

#include "simplelink.h"
#include <stdio.h>
#include <stdlib.h>

int32_t exoPal_sendingComplete()
{
    return 0;
}

int32_t exoPal_atoi(char* val)
{
    return atoi(val);
}
Shvet Chakra
  • 1,043
  • 10
  • 21
  • 1
    Compiles fine for me using gcc (after I remove `#include "simplelink.h"` which I obviously don't have). Could there perhaps be something problematic in that file? – Nate Eldredge Dec 15 '15 at 03:47
  • 2
    Please `#include ` in the implementation file and try again. See if any other problems arise. as Given, I don't see a problem here. Strange enough is the message "... C/C++ problem". Which compiler is that? If you use a C++ compiler to compile C code: **don't!** – too honest for this site Dec 15 '15 at 03:48
  • I added the #include and I still get the same errors. What I noticed though at exosite_pal.c is that the int32_t at the file is not highlighted compared to exosite_pal.h. The int32_t at exosite_pal.h text color is green while the int32_t at exosite_pal.c text color is black. I have already asked about this from exosite who is the owner of these files. – Markel Robregado Dec 15 '15 at 03:55
  • It looks like there is a problem with the signed return types.. Try returning a uint32_t and confirm this. – Dylan Kirkby Dec 15 '15 at 03:57
  • Perhaps one is compiled C and the other C++? Error does say "C/C++ Problem". – chux - Reinstate Monica Dec 15 '15 at 03:58
  • @DylanKirkby same error. What I noticed is that at exosite_pal.c if I select int32_t and press "F3" which is search for referenced file, it goes to a user.h within simplelink folder. user.h has #define int32_t _i32 – Markel Robregado Dec 15 '15 at 04:03
  • @chux - the files are compiled in one CCS project. It does say C/C++ Problem. See at my first post. – Markel Robregado Dec 15 '15 at 04:07
  • If the C++ compiler is messing with your function declarations that could be a problem. Try putting your prototypes in an extern "C" { ... } block. (Like this http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c) – Dylan Kirkby Dec 15 '15 at 04:13
  • 1
    Error message says lines 509 and line 260. Does not look like the posted exosite_pal.c – chux - Reinstate Monica Dec 15 '15 at 04:16
  • I think if you can try putting the #include "exosite_pal.h" as the last header file. – Ritesh Dec 15 '15 at 04:17
  • @chux - exosite_pal.c has lots of other functions. I just copied and pasted here the relevant ones related to this error. – Markel Robregado Dec 15 '15 at 04:31
  • @Ritesh - putting #include exosite_pal.h as the last header file at exosite_pal.c solves the error. Thanks. I have other errors now. – Markel Robregado Dec 15 '15 at 04:35
  • But, what is the explanation to that solving the error. Is it because the other #include are causing the problem? – Markel Robregado Dec 15 '15 at 04:37
  • 1
    By copying and pasting only the relevant parts and _not_ regenerating the error, the veracity of the post is in question. – chux - Reinstate Monica Dec 15 '15 at 05:03
  • The new error I am getting are below. I will search about this at stackoverflow. #258 invalid redeclaration of type name "_u32" (declared at line 360 of "C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/simplelink.h") .ccsproject /getting_started_with_wlan_station_exosite_write line 47, external location: C:\CCSV6\ccsv6\tools\compiler\ti-cgt-arm_5.2.2\include\stdint.h C/C++ Problem – Markel Robregado Dec 15 '15 at 05:09
  • I solved this new error message by putting #include after #include and then moving #include "simplelink.h" after #include . I just did trial and error and worked. Thanks for all your comments. – Markel Robregado Dec 15 '15 at 05:18
  • in general, for a specific header file to use something defined in another header file, that other header file must be #include first. – user3629249 Dec 15 '15 at 08:48

0 Answers0