Page 1 of 1

Salvo 'OSC' define conflict with '#pragma config'

PostPosted: Wed Sep 07, 2005 3:52 am
by DFx_Tech
Hi Andrew,

I have a problem with migrating my code to use the '#pragma config' commands required by the latest Microchip C18 compiler.

The instruction for setting the oscillator is now:

"#pragma config OSC = xxxx"

Obviously this doesn't work as salvo defines OSC in salvo.h.

I didn't want to try messing with the salvo source myself as I may break something adding a prefix to all instances of OSx.....is there any chance of a bug fix for this?

- Jon


Re: Salvo 'OSC' define conflict with '#pragma config'

PostPosted: Wed Sep 07, 2005 7:59 am
by aek
Hmmm .. that's a good point.

Two ideas:

1) In the file where you declare the pragma, simply

#ifdef OSC
#undef OSC
#endif

before the pragma.

2) Comment out the #define OSC line in salvo.h. I don't think you'll need it for MPLAB-C18. OSC seems to be the only "word" / abbreviation that might conflict with other three-letter "OS?" symbols.

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


Re: Salvo 'OSC' define conflict with '#pragma config'

PostPosted: Wed Sep 07, 2005 8:25 am
by DFx_Tech
Good point, I had forgoten that you could undefine things

My solution at the momment is to have a seperate C file just for #pragma config's, then I don't have to include salvo.h and can avoid the problem entirely.


Re: Salvo 'OSC' define conflict with '#pragma config'

PostPosted: Sat Mar 11, 2006 1:29 am
by Milind

Thanks for the solution.
I was trying to find a solution
to the same problem , when I came across
this formu, and your discussion.