News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Redeclaration, error #2120

Started by GuF, May 19, 2006, 08:39:10 PM

Previous topic - Next topic

GuF

Pelles C 4.0 doesn't compile this (redeclaration, error #2120):


int a() {
void b();
}

static void b() {
}


Thanx, if you could have a look on this!

DMac

You have reversed the proper order try this:

static void b() {
}

int a() {
  void b();
}

or use a prototype for void b()

also you do not need to prepend keyword "void" to b when you are calling it from within a.

int a() {
  b();
}

-DMac
No one cares how much you know,
until they know how much you care.

Synfire


int a() {
  void b();
}

static void b() {
}


That's because you are prototyping the b() function twice. If you wish to typecast, you must encapsulate the cast in parethesis like so


#include <stdio.h>

static void b ( void );
int a ( void );

int a() {
  (void) b();
  return ( 0 );
}

static void b() {
}

int main () { return ( a ( ) ); }


To note another possible error, in you code you define a() as an int but don't return anything. None the less, the code above compiles without a hitch as a console app.

Regards,
Bryant Keller