Jump to content

"extern" in mplab


Aliã Bianco
 Share

Recommended Posts

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

Link to comment
Share on other sites

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++; }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...