Jump to content

Recommended Posts

Posted

Hi guys,

im using mplab to try compile my project,

but wen i compile the project, i get an error.

here is the cause:

This explanation i found in readme of mplab c18.

Referencing a variable declared 'extern' with an initializer causes an internal failure. For example:


  extern int x = 5;

  void main (void) { x++; }


generates an internal error. The workaround is to remove the 'extern' storage class specification or remove the initializer.

what should i do???

kill me? mysys dont work, mplab dont work... i dont have more ideas.

thanks

Posted

Hi guys,

im using mplab to try compile my project,

but wen i compile the project, i get an error.

here is the cause:

This explanation i found in readme of mplab c18.

Referencing a variable declared 'extern' with an initializer causes an internal failure. For example:


  extern int x = 5;

  void main (void) { x++; }


generates an internal error. The workaround is to remove the 'extern' storage class specification or remove the initializer.

what should i do???

kill me? mysys dont work, mplab dont work... i dont have more ideas.

thanks

My guess is to follow the suggestion:

1) define the variable in the local module ie:

int x=5;

void main (void) { x++; }

OR

2) initialise it in the module where it is defined ie. int x=5;

AND declare it (but dont initialise it) where it is used (locally) so your code would be:

extern int x ;

void main (void) { x++; }

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...