Solved

Error message confusion.

Posted on 1997-12-03
2
124 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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now