Solved

Error message confusion.

Posted on 1997-12-03
2
126 Views
Last Modified: 2010-04-02
Hi,
Ok...Here's the function that I have:

void Set_Palette_Register(int index, RGB_color_ptr color)
{
    _outp(PALETTE_MASK, 0xff);

    _outp(PALETTE_REGISTER_WR, index);

    _outp(PALETTE_DATA,color->red);
    _outp(PALETTE_DATA,color->green);
    _outp(PALETTE_DATA,color->blue);
}
Now the error message says:
"error C2084: function 'Set_Palette_Register' a;ready has a body"
I'm using Microsoft C/C++ version 1.0, and you know how you can double click on the message and it'll zoom you to the excact line that the error is occuring; it takes me to the first braket '{' and as you can see there isn't anything else there. I'm at a total loss as to what the compiler means by that error So I was wondering if you could help.
Thank you,
Crash
0
Comment
Question by:crash020297
2 Comments
 
LVL 10

Accepted Solution

by:
RONSLOW earned 200 total points
ID: 1256491
What is probably happening is that either you have put this in a .h file and it has been included twice (hence the error).

Or you have put something like this in your .h file

void Set_Palette_Register(int index, RGB_color_ptr color) {}

instead of

void Set_Palette_Register(int index, RGB_color_ptr color);

Basically, you have the function written more than once (or the same definition being included more than once).

Just search for all occurences of the name and see where you define it with a body [ie. {...}]

Roger




0
 

Author Comment

by:crash020297
ID: 1256492
Thanks,
I can't believe I typed it twice. Isn't it the idea to have header files so you don't have to keep typing....
well, thank you very much.
crash
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question