Did you try defining a local var count within the function to see if the error goes away? Mark Ariel Rocholl wrote: > Your function has an obvious dependency on "count" variable being globally > defined. > > Have you defined it on the new program before this function is declared? > > 2010/2/25 sergio masci > > >> On Thu, 25 Feb 2010, Jason Hsu wrote: >> >> >>> The code is as follows: >>> >>> void delay_1_msec (void) >>> { >>> count = 110; >>> while (count>0) >>> { >>> count--; >>> } >>> } >>> >>> Everything compiles and works when I use this function declaration in >>> >> Program A. >> >>> I have a second program, Program B that also works as expected. >>> >>> However, when I cut and paste this code snippet from Program A to >>> Program B (which also worked), Program B refuses to compile (even with >>> the line calling the function commented out). The errors I'm getting >>> are: >>> no identifier in declaration >>> >>> missing basic type; int assumed >>> >>> ";" expected >>> >>> Given that this same code worked in another program, I doubt that this >>> is a syntax error. Yes, I have declared the variable count as an >>> unsigned char. In fact, I have a similar pre-existing function in >>> Program B that caused no problems. The function declaration is: >>> >>> void delay_20_usec(void) >>> { >>> count = 2; >>> while (count>0) >>> { >>> count--; >>> } >>> } >>> >>> What am I overlooking? >>> >> Check your source code (including header files) to see if 'delay_1_msec' >> has been delared as a macro (or manifest constant). >> >> Check that you have actually inserted the code in a place that is valid. >> >> e.g. >> >> int fred >> bert; >> >> changed to >> >> >> int fred >> >> void delay_1_msec (void) >> { >> count = 110; >> while (count>0) >> { >> count--; >> } >> } >> >> >> bert; >> >> >> Regards >> Sergio masci >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> >> > > > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist