Compilation error with prototypes

I need a little help since I keep getting these errors while compiling. I can't find an answer that helps me out via google. I keep getting this error...

"both separate parameter declaration and parameter list declaration are used"

It refers to both off my global variables. These global vars are used when an interrupt is called. The compiler also gives a syntax error in the code off the interrupt. With the little knowledge that I have, I can't seem to find any errors. I even compared it with the examples off this site.

Thx in advance for some advice... here's the code. I stripped it a bit not to overwhelm you ;)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include "mb90560.h"
#include "prototypes.h"

/********__GLOBAL_VARIABLES__***********************/

int int_count;
unsigned int Result_ADC;

/********@_THE_"MAIN"_COURSE_@********************/

struct struct2{				/* bitfield structure */
	int knipper : 1;			/* 1e LED off 8 as indicator. Knippertijd 0,25s */
	int ADC_VU	: 7;			/* 7 bits for ADC value */
};


void main(void)
{

		int_count = 0;			/* interrupt counter at 0 
		struct2 *p_struct2;	
		p_struct2 = ( struct2*) &PDR0;
}


/********__INTERRUPT FUNCTIES__********************/


__interrupt void irq_adcint(void)
{
		Result_ADC = GetADCResult();
}


__interrupt void ReloadTimer0 (void)
{
		if (int_count++ == 25){
		PDR0_P07 = ~PDR0_P07;	/* Flip bit en set opnieuw terug (Bitwise Complement) */
		int_count = 0;
		}

	TMCSR0_UF = 0;		/* interrupt flag timer op 0 zetten, soort reset ter afsluiting */
}
You've managed to cut out part of a comment on line 21 (it's not terminated).

void main(void)

main() always returns an int. Always.

What is the exact error message and what line is it referring to?
Sorry about line 21. I accidentally deleted it while stripping some code...

I get the following errors....

line 7: both separate parameter declaration and parameter list declaration are used
line 8: both separate parameter declaration and parameter list declaration are used

line 12: `struct struct2' declared in parameter declaration

line 19: both separate parameter declaration and parameter list declaration are used
line 19: syntax error near `{'

The last two errors noted at line 19, also occur at line 31 & 37.
Btw,

I did forgot to mention an important part off the code...

1
2
3
4

		while(1){
	 		ADC_VU = Result_ADC();		/* constant loop to load new value ADC into the bitfield struct */
		}


This is the loop where it constantly monitors a change off the ADC interrupt value. Generated in...
__interrupt void irq_adcint(void)
Are you sure your header files don't have anything wrong with them? The code in the header might be causing some conflict with the code here.
I've build the whole project and it only stumples upon these things...
I found the compiler manual but I need a little help to translate it to a newby kinda language.

Explanation for errors at line 7,8, 19, 34 & 40...
Though a function is defined with a prototype declaration, non-prototype parameters are also declared.
The separate parameter declaration is not needed.


Explanation for struct error:
A tag is declared in a parameter declaration of a non-prototype function definition at the same time. The
scope where the tag is visible is the block scope from the tag declaration to the end of the function, then
a parameter type mismatch may occur in a function call.
Continues the compilation making the declaration valid.
I have to agree with spaggy. I think one of your headers, probably prototypes.h, is messed up.
I double checked everything and stripped contents of the header file, into the main file... Added, stripped en rebuild several things.

Only...

I still get the same problems. I loaded the C file into a sample project that gives no errors while compiling. When I overwrite it with my C file, it still generates the same errors. I talking about these errors...

line 19: both separate parameter declaration and parameter list declaration are used
line 19: syntax error near `{'


Plus the same error happens at every beginning of a function or interrupt function. Pfff, I'm out off ideas.

What did you exactly mean with #defines messing up while compiling ?
Can I see what the header file looks like?

Go read up on what #defines can do and you should be able to figure out why they can easily screw things up.
Oh, that header is really big. It also comes with a .c file.

Thing is, I copy/pasted it into a working sample project. So in fact, the header shouldn't have any messed up #defines or other things.
Topic archived. No new replies allowed.