CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Not able to declare a global structure

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
misperry



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

Not able to declare a global structure
PostPosted: Sun Mar 28, 2010 11:40 am     Reply with quote

Hey all I am banging my head against the wall over this. My compiler does not let me declare global structures. I am using the lcd.c and I get 100 compiler errors uppon compiling.

I know what the cause of this is because I ran into it when I was using structures in other codes that I developed myself. If you use the following:
Code:

struct test{
int one;
int two;
int three;
}tst_one;

it will give you these errors you are declaring ts_one globally but if you place "tst_one" inside a function declaration and declare it locally then this will alleviate the errors.

I am wondering if it is a problem with the compiler. I have heard that there are some problems with the version I have and I was just wondering if this is one of those problems.

I have version PCM 4.025.

Any help would be appreciated. If you need me to upload code just say so.

Thanks for all your help!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 1:40 pm     Reply with quote

Post a very small test program the shows the problem.
It must be copy-and-paste compilable, with no errors.

Here's an example of what I mean by a small test program:
http://www.ccsinfo.com/forum/viewtopic.php?t=28849&start=1
It has the minimum necessary code to show the problem.
(No Wizard code).
misperry



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 8:21 pm     Reply with quote

Thanks so much for the reply but I think I have figured it out. I was thinking it was a problem with the structure but it was a problem with MPLAB. I had the lcd.c file placed in the source folder instead of the "other" folder. I have a link to a post that has some additional links to how MPLAB works with using multiple source and header files in a program.

http://www.ccsinfo.com/forum/viewtopic.php?t=35724

Thank you so much for your reply! Oh and for anyone else that sees this post make sure that you have the #include "lcd.c" after all you #include <PICxxxxxx.h> as well as your #fuses and your #use delay commands. This fixed a bunch of errors like the Need #define Error and the undeclared identifier delay_ms and delay_us errors. You must include the lcd.c file after the pic header include declaration so that the #define is issued prior to the lcd.c file include as well as the delay has to be set prior to the include of the lcd.c.

Any other questions please feel free to reply to this post for anyone else having trouble with the lcd.c driver.

Thanks again! CCS C rocks!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group