uint8_t type gets duplicated for the LPCXpresso1549 board. SOLVED.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

uint8_t type gets duplicated for the LPCXpresso1549 board. SOLVED.

673 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Wed Dec 03 14:43:21 MST 2014
Hi,

As I've said, such type gets duplicated when compiling a project. From the info that the compiler spits out it seems to be a problem with board.h and chip.h inclusion files. This is the error output:


../src/project1.cpp:36:2: error: 'uint8_t' redeclared as different kind of symbol
  uint8_t val,
  ^
In file included from /usr/local/lpcxpresso_7.2.0_153/lpcxpresso/tools/lib/gcc/arm-none-eabi/4.8.3/include/stdint.h:9:0,
                 from /home/xavier76/LPC1549_WS/lpc_chip_15xx/inc/lpc_types.h:35,
                 from /home/xavier76/LPC1549_WS/lpc_chip_15xx/inc/chip.h:32,
                 from /home/xavier76/LPC1549_WS/lpc_board_nxp_lpcxpresso_1549/inc/board.h:35,
                 from ../src/project1.cpp:21:
/usr/local/lpcxpresso_7.2.0_153/lpcxpresso/tools/arm-none-eabi/include/stdint.h:42:19: error: previous declaration of 'typedef __uint8_t uint8_t'
 typedef __uint8_t uint8_t ;


And this is the source code that fails to compile:

/*-----------------------------------------------------------------------------
 *  project1.cpp cropped source code 
 *-----------------------------------------------------------------------------*/

#include "board.h" /***** Line (21) *****/
#include <cr_section_macros.h>

typedef enum
{
Err_OK = 0,
Err_Fail,
} Error_E;

typedef enum
{
uint8_t val, /***** Line (36) *****/
Error_E error,
} RetVal_Type;

// And from here there are a lot of errors because uint8_t type duplication




Any ideas? Thank you in advanced

Labels (1)
0 Kudos
Reply
2 Replies

627 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Thu Dec 04 11:19:27 MST 2014
[color=#f00]*** SOLVED ***[/color]

Thank you for your prompt reply. The project was created for the C++ compiler, and it is using the newlib library. It was a silly error that I'm ashame of my self. Originally I wrote:

typedef enum // code (1)
{
uint8_t val,
Error_E error,
} RetVal_Type;


but what I meant was:

typedef struct // code (2)
{
uint8_t val;
Error_E error;
} RetVal_Type;


In code (1) I was (erronously) trying to redifine the uint8_t type; that's way the compiler got very angry at me. Code (2) is the correct one.




Quote: lpcxpresso-support
If you are using C++, then you will be using Newlib (or Newlib-Nano) libraries and headers, rather than the Redlib library and header files. However the LPCOpen libraries are supplied configured for Redlib. I suspect that this is what is causing your problem.

Try changing the project settings for your LPCOpen board/chip libraries to Newlib. For details of how to do this see:

http://www.lpcware.com/content/faq/lpcxpresso/switching-selected-c-library

And for further library related FAQs see:

http://www.lpcware.com/faq/c-library

Regards,
LPCXpresso Support


0 Kudos
Reply

627 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 04 01:07:54 MST 2014
If you are using C++, then you will be using Newlib (or Newlib-Nano) libraries and headers, rather than the Redlib library and header files. However the LPCOpen libraries are supplied configured for Redlib. I suspect that this is what is causing your problem.

Try changing the project settings for your LPCOpen board/chip libraries to Newlib. For details of how to do this see:

http://www.lpcware.com/content/faq/lpcxpresso/switching-selected-c-library

And for further library related FAQs see:

http://www.lpcware.com/faq/c-library

Regards,
LPCXpresso Support
0 Kudos
Reply