Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

Discussion Groups | Rabbit-Semi | weird compiler error

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

weird compiler error - "Dave M." - Mar 13 16:20:11 2008

So I've got this project that I haven't worked on in a long time. It
still compiles fine in Dynamic C Premier 9.21. But then today I
decided to move some #defines and a struct out of one header and into
another. I then added the new header file to LIB.DIR, and #used the
new header file as well. Upon compilation, I got a slew of errors,
basically saying that all of the #defines that I moved are "out of scope".

The funny thing is that if I try to open the file via the context
menu, the new header file opens fine, which proves that DC was able to
scan successfully and find the file... and those #defines are
definitely there.

I then tried to upgrade to DCP 9.52 -- same problem.

I then tried to recreate the problem using a really basic sample
program, so that I could post the code here. Here's what I did:

1. created header file called "argh.h", and all it has inside is:

#define ARGH 1

2. created a program file called "test.c", and it looks like this:

#memmap xmem

#use "argh.h"

void main()
{
int i;
i = ARGH;
}

This works fine IF I don't assign i to ARGH, but if I do, I get the
following error:

line 8 : ERROR TEST.C : ARGH is out of scope/ not declared.

Now, it's possible that I'm missing something because I haven't used
DCP in a long time, but I believe this should compile! :)

Has anyone else had ridiculous compiler issues like this before? Any
idea how to solve it? I've tried:

- moving files around in LIB.DIR
- moving the #use around in the file
- commenting out everything in the header file and moving one #define
to the top -- still got the compiler error

I'm totally confused...



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )


Re: weird compiler error - "Dave M." - Mar 15 5:37:54 2008

haha... all these years I thought BeginHeader and EndHeader were only needed for functions, but apparently you have to have then in the header file or DCP doesn't 'see' the type definitions and #defines! That was sure fun to figure out. :)

--- In r...@yahoogroups.com, "Dave M." wrote:
>
> So I've got this project that I haven't worked on in a long time. It
> still compiles fine in Dynamic C Premier 9.21. But then today I
> decided to move some #defines and a struct out of one header and into
> another. I then added the new header file to LIB.DIR, and #used the
> new header file as well. Upon compilation, I got a slew of errors,
> basically saying that all of the #defines that I moved are "out of scope".
>
> The funny thing is that if I try to open the file via the context
> menu, the new header file opens fine, which proves that DC was able to
> scan successfully and find the file... and those #defines are
> definitely there.
>
> I then tried to upgrade to DCP 9.52 -- same problem.
>
> I then tried to recreate the problem using a really basic sample
> program, so that I could post the code here. Here's what I did:
>
> 1. created header file called "argh.h", and all it has inside is:
>
> #define ARGH 1
>
> 2. created a program file called "test.c", and it looks like this:
>
> #memmap xmem
>
> #use "argh.h"
>
> void main()
> {
> int i;
> i = ARGH;
> }
>
> This works fine IF I don't assign i to ARGH, but if I do, I get the
> following error:
>
> line 8 : ERROR TEST.C : ARGH is out of scope/ not declared.
>
> Now, it's possible that I'm missing something because I haven't used
> DCP in a long time, but I believe this should compile! :)
>
> Has anyone else had ridiculous compiler issues like this before? Any
> idea how to solve it? I've tried:
>
> - moving files around in LIB.DIR
> - moving the #use around in the file
> - commenting out everything in the header file and moving one #define
> to the top -- still got the compiler error
>
> I'm totally confused...
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )