Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin18-Dec-16 15:26
professionalAlbert Holguin18-Dec-16 15:26 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
ForNow18-Dec-16 15:52
ForNow18-Dec-16 15:52 
AnswerRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin18-Dec-16 15:59
professionalAlbert Holguin18-Dec-16 15:59 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
ForNow18-Dec-16 16:18
ForNow18-Dec-16 16:18 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin18-Dec-16 16:28
professionalAlbert Holguin18-Dec-16 16:28 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
ForNow18-Dec-16 16:34
ForNow18-Dec-16 16:34 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin18-Dec-16 17:02
professionalAlbert Holguin18-Dec-16 17:02 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
leon de boer18-Dec-16 16:31
leon de boer18-Dec-16 16:31 
Haha if we have ruled out multiple includes let me guess at this ... ready

You have a forward declaration prototype at line 43
>>> cpu.c(43):void hex_to_ascii(BYTE *ipx, char *str, int num);

You have the body presented at line 1606
>>> cpu.c(1606): void hex_to_ascii(BYTE *ipx, char *str, int num)

BYTE is a non standard and often misused piece of junk definition often abused by people. I am going to guess the definition of BYTE between line 43 and 1606 changes. So it's trying to tell you that you forward declared a prototype in that name already and your new body mismatches its definition and is trying to define under the same name.

Usually the problem is BYTE gets defined as a char one place and as unsigned char somewhere else and so the compiler has two non matching definitions of BYTE. You just see the word BYTE but you can't see it's definition. In Visual studio if you right click on the word BYTE in both cases and on the menu click on "goto definition" it will show you what it is using for the two definitions.

This is the reason the standards type unit was created to stop this sort of problem. If that is the problem the solution is simple #include <stdint.h> and use the proper standard type uint8_t which is an unsigned 8 bit integer which is after all what the non standard BYTE definition is I imagine.
In vino veritas


modified 18-Dec-16 23:48pm.

AnswerRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Richard MacCutchan18-Dec-16 21:48
mveRichard MacCutchan18-Dec-16 21:48 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Peter_in_278018-Dec-16 23:09
professionalPeter_in_278018-Dec-16 23:09 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Richard MacCutchan19-Dec-16 5:38
mveRichard MacCutchan19-Dec-16 5:38 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
leon de boer19-Dec-16 19:03
leon de boer19-Dec-16 19:03 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin21-Dec-16 10:41
professionalAlbert Holguin21-Dec-16 10:41 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
leon de boer23-Dec-16 6:26
leon de boer23-Dec-16 6:26 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
Albert Holguin23-Dec-16 7:25
professionalAlbert Holguin23-Dec-16 7:25 
GeneralRe: C2084 FUNCTION ALREADY HAS A BODY Pin
leon de boer23-Dec-16 8:37
leon de boer23-Dec-16 8:37 
QuestionMFC code to move a train in two directions Pin
Member 1289526213-Dec-16 19:17
Member 1289526213-Dec-16 19:17 
AnswerRe: MFC code to move a train in two directions Pin
CPallini13-Dec-16 21:22
mveCPallini13-Dec-16 21:22 
AnswerRe: MFC code to move a train in two directions Pin
jeron114-Dec-16 4:40
jeron114-Dec-16 4:40 
GeneralRe: MFC code to move a train in two directions Pin
Richard MacCutchan14-Dec-16 5:08
mveRichard MacCutchan14-Dec-16 5:08 
GeneralRe: MFC code to move a train in two directions Pin
jeron114-Dec-16 5:11
jeron114-Dec-16 5:11 
SuggestionRe: MFC code to move a train in two directions Pin
David Crow14-Dec-16 5:36
David Crow14-Dec-16 5:36 
AnswerRe: MFC code to move a train in two directions Pin
Chris Losinger14-Dec-16 11:00
professionalChris Losinger14-Dec-16 11:00 
AnswerRe: MFC code to move a train in two directions Pin
Gerry Schmitz14-Dec-16 12:21
mveGerry Schmitz14-Dec-16 12:21 
AnswerRe: MFC code to move a train in two directions Pin
Patrice T14-Dec-16 12:45
mvePatrice T14-Dec-16 12:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.