We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi!
How make preprocessor error? #error - not work in keil 4.12 (ARM)
#ifdef IO16_A CPU_CLOCK = 50; #elif IO16_B CPU_CLOCK = 25; #elif IO16_C CPU_CLOCK = 8; #else
#error "No select device type!"
#endif
#ifdef IO16_A CPU_CLOCK = 50; #elif IO16_B
You almost certainly don't want to do that. That needs to be either
#if IO16_A CPU_CLOCK = 50; #elif IO16_B
or
#if defined(IO16_A) CPU_CLOCK = 50; #elif defined(IO16_B)
I find out: generate syntax error
#ifdef IO16_A if(strncmp(&FileName[0], "main_IO16_A", 11) == 0 && strncmp(&FileName[NameLen - 6], "_C.bin", 6) == 0)
#elif REL6HC_A if(strncmp(&FileName[0], "main_REL6HC_A", 13) == 0 && strncmp(&FileName[NameLen - 6], "_C.bin", 6) == 0)
#elif COM2_C if(strncmp(&FileName[0], "main_COM2_C", 11) == 0 && strncmp(&FileName[NameLen - 6], "_C.bin", 6) == 0)
#elif REL12LC_A if(strncmp(&FileName[0], "main_REL12LC_A", 14) == 0 && strncmp(&FileName[NameLen - 6], "_C.bin", 6) == 0)
#elif IR4_B if(strncmp(&FileName[0], "main_IR4_B", 10) == 0 && strncmp(&FileName[NameLen - 6], "_C.bin", 6) == 0)
#else "Error message: No type Device HTTP_CGI" //compiler generate syntax error
#endif { ErrorChannel = 0; return; }
That'll be because it's not valid 'C' syntax!
Did you copy & paste the exact text from your source code?
And still using the old and deprecated #ifdef instead of the newer #if defined(xx) and mixing it with the completely different #if - haven't you figured out that #if and #ifdef does not do the same thing?
I find out:
No --- you're deluding yourself. You obviously didn't find out anything. You're just making the same mistake 5 times instead of the original 2 times.