• AVR Freaks

AnsweredHot!Error in Machine Generated Code uint16_t

Author
Mildly Clueless
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2019/06/05 23:27:10
  • Location: 0
  • Status: offline
2019/06/07 20:53:48 (permalink)
0

Error in Machine Generated Code uint16_t

 
Apologies if I am not getting the question format on point.  The introduction page gave me a 404 error.
 
I am adding a few lines to clear some small issues that was generated on MPLab 4.15 while my machine has 5.10.  My code has no issues but the new version (or possibly different compiler does not like the following
 
/**
* result size of an A/D conversion
*/
typedef uint16_t adc_result_t;
#ifndef int24_t
typedef signed long int int24_t;
#endif
/** ADC Channel Definition
 
The builder reports 
mcc_generated_files/adcc.h:74:25: error: typedef redefinition with different types ('long' vs '__int24')
typedef signed long int int24_t;
^
 
While IDE code editor shows a 
Unable to resolve identifier on  uint16_t
and also does not like the second typedef warning of redefinition.
 
If I go back to the original machine, it goes through, but not really excited to have to ask to use that machine because of a couple of looks like minor errors, but can't seem to find the source.
 
Thanks
 
#1
moser
Super Member
  • Total Posts : 504
  • Reward points : 0
  • Joined: 2015/06/16 02:53:47
  • Location: Germany
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 09:11:56 (permalink)
+1 (1)
You forgot to mention your compiler.
 
Are you aware, that a typedef is different from a #define, and a #ifndef only checks for #define and not for typedef?
 
Several compilers do not only tell you that there is a redefinition, but also the location where it was first defined. Did you not show us, or is this information not available?
 
Did you already start a reparse (right click on your project in the "Projects" tab > Code Assistance > Reparse project)? Does this help you to get to the location where int24_t or uint16_t is already defined?
#2
NKurzman
A Guy on the Net
  • Total Posts : 17846
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Error in Machine Generated Code uint16_t 2019/06/11 10:14:38 (permalink) ☼ Best Answerby jregester 2019/06/11 18:11:27
+1 (1)
First MPLabX does Not Generate Code.  MCC does. It has it own version.
Are You Using the Compiler Version that was used for the Original Code?
If you are using XC8 V2.XX you may need to disable C99 support.  Select C90 Mode.
 
#3
1and0
Access is Denied
  • Total Posts : 9762
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 11:24:44 (permalink)
0
jregester
/**
* result size of an A/D conversion
*/
typedef uint16_t adc_result_t;
#ifndef int24_t
typedef signed long int int24_t;
#endif
 
The builder reports 
mcc_generated_files/adcc.h:74:25: error: typedef redefinition with different types ('long' vs '__int24')
typedef signed long int int24_t;
^

Since the error message mentions __int24, I guess it's C99 mode of the XC8 compiler where it has a definition of
typedef __int24 int24_t;

so what you are doing is redefining the int24_t type.
 
That said, why are you trying to type define a 32-bit type with a 24-bit name?
#4
Mildly Clueless
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2019/06/05 23:27:10
  • Location: 0
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 18:10:59 (permalink)
0
Thanks All:
Compiler version issue.  Changed it to C90 and these issues went away.  A few new ones arrived but it was a good trade.
#5
ric
Super Member
  • Total Posts : 23859
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Error in Machine Generated Code uint16_t 2019/06/11 18:18:06 (permalink)
+1 (1)
You still have not mentioned WHICH compiler you are using.
It must be v2.xx, but we don't know what "xx" is.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#6
Mildly Clueless
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2019/06/05 23:27:10
  • Location: 0
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 18:46:57 (permalink)
-1 (1)
I was keeping it a secret.
'wisper' it was compiler version XC8 (v2.05) '/wisper'
#7
1and0
Access is Denied
  • Total Posts : 9762
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 18:56:48 (permalink)
+2 (2)
C90 works because it has
#define int24_t int24_t

which will skip this code of yours
#ifndef int24_t
typedef signed long int int24_t;
#endif

 
Again, why are you trying to type define that?
#8
1and0
Access is Denied
  • Total Posts : 9762
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/11 19:05:03 (permalink) ☄ Helpfulby jregester 2019/06/11 19:19:42
+1 (1)
For the C99 equivalent it is this
#ifndef __DEFINED_int24_t
typedef signed long int int24_t;
#endif

#9
mlp
boots too small
  • Total Posts : 805
  • Reward points : 0
  • Joined: 2012/09/10 15:12:07
  • Location: previously Microchip XC8 team
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/12 13:10:38 (permalink)
0
(compiler version)
jregester
I was keeping it a secret.

What did you hope to achieve by this?

Mark (this opinion available for hire)
#10
Jim Nickerson
User 452
  • Total Posts : 6259
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/12 13:17:21 (permalink)
0
I think he was missing the Smile: Smile
#11
1and0
Access is Denied
  • Total Posts : 9762
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/12 13:52:19 (permalink)
0
I guess we will never know why the OP wanted to type define that. pink: pinksad: sadmad: mad
#12
davea
Senior Member
  • Total Posts : 153
  • Reward points : 0
  • Joined: 2016/01/28 13:12:13
  • Location: 0
  • Status: offline
Re: Error in Machine Generated Code uint16_t 2019/06/17 18:17:02 (permalink)
0
moser
Did you already start a reparse (right click on your project in the "Projects" tab > Code Assistance > Reparse project)?


I just installed 5.20 and had the red blob everywhere did the reparse and it fixed everything
is that expected to happen or just a fluke
#13
Jump to:
© 2019 APG vNext Commercial Version 4.5