Jump to content
Sign in to follow this  
chedzoy

C2C limit on local variables

Recommended Posts

Is there a built in limit on the number of local variables declared in a single project. I'm writting a big project for PIC16F876. All was fine until suddenly the compiler stopped defining my local variables in the .asm file. For example a simple function like..

 

void test(void)

{

   char t;

   t = 0;

}

 

compiles OK, but generates:

 

symbol not previously defined (_t_test)

on assembly.

Share this post


Link to post
Share on other sites
Guest Pavel

There number of variables (both global and local) is limited only by the available memory on the target. Can you create a simple project that exposes this problem, zip the whole project directory and send it to support@picant.com.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Sorry, I tried to make a simple example, but it didn't fail. I've worked around the problem by declaring the variable that was failing as a global. I have noticed that the problem only seems to apply to one of the source files in my project! I can still declare new local variables in other source files.

 

I'll let you know if I discover anything else or get a simple example to fail

 

Regards

 

Chris

Share this post


Link to post
Share on other sites
Sorry, I tried to make a simple example, but it didn't fail. I've worked around the problem by declaring the variable that was failing as a global. I have noticed that the problem only seems to apply to one of the source files in my project! I can still declare new local variables in other source files.

Chirs, just so you won't feel crazy, I wanted to say that I have had the same problem couple times. I don't know any always working solution for it, except adding the missing variable declaration to assembler file after every compile. Global variables are another solution, but I hate that.

Share this post


Link to post
Share on other sites
Guest Pavel

If this happens again can you turn off the option "One local variable space" and check if it helps?

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

I just Had the same problem, the project I have been working on & off, for 6 months. The project is now quite large.

I have 5 include files, most of these functions only having 1-2 char 's. All was fine until I decided to tidy-up my code in "main" creating a function for each task. Then it failed to complie so I have just went back to my old code, which is bit untidy.

 

The complier seems to do ok until the message

Adding page switching ......

And then gives errors messages like can't find the PIC header file

 

Pavel I can sent you the source files, if want. I just tried it with 5.4v no luck. :D

Share this post


Link to post
Share on other sites
Guest Pavel
Pavel I can sent you the source files, if want. I just tried it with 5.4v no luck. :D

Yes please (zip the whole project directory and send it to support@picant.com). If there is a bug I'll be interested to fix it.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...
Sign in to follow this  

×
×
  • Create New...