chief 0 Posted April 17, 2011 Report Share Posted April 17, 2011 Can anybody tell me why the compiler doesn't like this bit of code? void startup() { while(1)//startup loop - chk subd conn, last_state, pause, check S1 { if(no_conn) //test if PS subd is connected { lcd_gotoxy( 0, 0 ); lprintf("PS not connected"); } else if (last_state == S)//SC {recover_SC();} else if (last_state == L)//NL {recover_NL();} else if (last_state == X)//exit {recover_exit();} else { lcd_gotoxy( 0, 0 ); lprintf("PS connected"); lprintf("\nS1 to start"); } delay_ms(100); if(S1 == 0) { while( S1 == 1) do_next_thing(); } }//end while loop }//end startup I get the message: Building... "C:\Program Files\SourceBoost\boostc++_pic16.exe" bias_burn_nr.cpp -t PIC16F877A -idx 1 -obj Debug -d _DEBUG bias_burn_nr.cpp(75:25): error: unknown identifier 'L' bias_burn_nr.cpp(75:25): error: invalid operand 'L' bias_burn_nr.cpp(75:22): error: failed to generate expression bias_burn_nr.cpp(75:6): error: error in the 'else' body of 'if' expression BoostC++ Optimizing C++ Compiler Version 7.02 (for PIC16 architecture) http://www.sourceboost.com Copyright© 2004-2011 Pavel Baranov Copyright© 2004-2011 David Hobday Licensed to (NAME) under Single user Pro License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited bias_burn_nr.cpp failure error: failed Done Quote Link to post Share on other sites
Reynard 0 Posted April 17, 2011 Report Share Posted April 17, 2011 How have you declared S, L and X ? Are they constants, enums or variables ? Does L really exist ? Try to avoid single letter names as they can get confused with register and bit names already defined in the PIC header file. Cheers Reynard Quote Link to post Share on other sites
chief 0 Posted April 18, 2011 Author Report Share Posted April 18, 2011 How have you declared S, L and X ? Are they constants, enums or variables ? Does L really exist ? Try to avoid single letter names as they can get confused with register and bit names already defined in the PIC header file. Cheers Reynard Thank you Reynard, It was a typo in my declarations. That's what I get for writing code on a netbook! Thanks for your help. I'm also changing them from letters to words. Brian Quote Link to post Share on other sites
Recommended Posts
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.