Solved

Error message confusion.

Posted on 1997-12-03
2
127 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
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…
The goal of this video is to provide viewers with basic examples to understand and use pointers 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.

821 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