Go Down

Topic: How to add customized compiling message under Arduino IDE (Read 1 time) previous topic - next topic

SteveChang

Hi All,
I want to add some customized output information in Arduino IDE when compiling the code written by me.
I tried #pragma message("hello"). It dispalyed nothing.
Can anybody know it?

Thanks,

Steve

Coding Badly


Coding Badly

#2
Jan 03, 2013, 05:06 am Last Edit: Jan 03, 2013, 06:15 am by Coding Badly Reason: 1

Another possibility (requires the condition to reduce to a compile-time constant)...

Code: [Select]
static void OutputsErrorIfCalled( void ) __attribute__ (( error("Unexpected condition encountered.") ));

void loop( void )
{
 if ( true )
 {
   OutputsErrorIfCalled();
 }
}

SteveChang


JediJeremy

Please don't.

I'm current looking for ways to disable the entire #pragma message system because devs are polluting it with "Hey, I'm so great!" messages that look like compilers errors to newbs.

Yes, we know we're using your library. We had to download and install it. Reminding us makes us look for a quieter one.

Coding Badly


OldSteve

Please don't.

I'm current looking for ways to disable the entire #pragma message system because devs are polluting it with "Hey, I'm so great!" messages that look like compilers errors to newbs.

Yes, we know we're using your library. We had to download and install it. Reminding us makes us look for a quieter one.
Compiler messages are very useful.
For instance, you can write your code to work on a particular board or boards, then have an error generated (and compilation aborted) if you accidentally try to compile it for a different board.

e.g.
Code: [Select]
#ifndef __AVR_ATmega2560__  // Mega2560
#error Wrong chip defined - cannot continue! Please use an ATMega2560
#endif


I don't see any reference to the possibility that this might be code for public use in a distributed library, so no need to panic. It's probably for his own use.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy