Go Down

Topic: How to show better error messages? (Read 1 time) previous topic - next topic

hypoglycemic

I am following the the wiichuck guide from here http://xii9190.wordpress.com/2008/03/11/wiichuck-adapter-for-arduino-diecimila/

I downloaded the example, however it does not compile on my computer with the following error message:

Code: [Select]

In function 'void nunchuck_init_with_power()':
In function 'void nunchuck_print_data()':

Not exactly the most useful thing in the world.

How can I get a more detailed error message? Is this simply because the error in question is not in the .pde but in a header file? What can I do to see what the problem is?

Anachrocomputer

#1
Jan 27, 2009, 07:50 pm Last Edit: Jan 27, 2009, 07:50 pm by anachrocomputer Reason: 1
All that message is telling you is where in the code the error was found.  It's the next few lines after those, that will tell you the actual error.  This is standard stuff for a C compiler.  Could you post the rest of it?

hypoglycemic

No, thats my problem. That is all that the software displays in the window.



Is there a log of output that I can check? Or do it manually from the command line?

Anachrocomputer

Bizarre!  I've never seen that happen before.  It's as if GCC has output a partial error message and then quit.  Or maybe, somehow, the GUI has started printing in black on a black background?

If you're running this on Linux, it's possible to see the output from standard output by invoking 'arduino' from a text window.  I wonder if you can do this on the Mac (I assume your using MacOS)?

hypoglycemic

If you go in to the package contents you can run it from there (or put it in the path obviously). Unfortunately it is not much more help.


mikalhart

I get that "error" sometimes.

Just on a hunch, try adding

Code: [Select]
#include <WProgram.h>
to the top of nunchuck_funcs.h.

Mikal

follower

I have a vague feeling the odd appearance is because the IDE is parsing the error incorrectly. If you use the verbose build setting in preferences you might be able to try re-compiling from the command line and see the full error--in fact you might see it with just the verbose build setting.

--Phil.

hypoglycemic

Quote
I get that "error" sometimes.

Just on a hunch, try adding

Code:

#include <WProgram.h>



to the top of nunchuck_funcs.h.

Mikal


This got it sorted. Thank you muchly.

Anachrocomputer

Glad you got it fixed!  But this seems to show up a bug somewhere in the Arduino IDE code, doesn't it?  Something is parsing GCC error message output, and failing?  So the true fix is to fix the bug in the IDE, surely?

dcb

#9
Jan 28, 2009, 03:44 pm Last Edit: Jan 28, 2009, 03:46 pm by dcb Reason: 1
is it the IDE? or is it that they implemented the error messages a bit differently on mac?  It could still be "fixed" in arduino probably, but not a bug per-se, rather a nice thing for the ide to do to for you to deal with yet another platform headache.

Anachrocomputer

Quote
but not a bug per-se, rather a nice thing for the ide to do to for you


IMHO, it is a bug.  The IDE is failing to display compiler error messages correctly.  Part of the job of the IDE is to do that, and in this case I think it is particularly frustrating for the user to find that the vital error message text has been lost.

mellis

Sounds like a bug in the IDE to me.  If you can figure out what the whole error message was, that would probably help track down the problem.  You can get the commands used to build the sketch by setting the build.verbose flag to true in your Arduino preferences file (check the preferences dialog for the location of the preferences file).

hypoglycemic

First is the error with verbose output:
Mac OS X 10.5.6    Arduino 12

Trying to run http://todbot.com/blinkm/example_code/BlinkMChuck/

Code: [Select]
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/pins_arduino.c -o/tmp/build2288.tmp/pins_arduino.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/WInterrupts.c -o/tmp/build2288.tmp/WInterrupts.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring.c -o/tmp/build2288.tmp/wiring.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_analog.c -o/tmp/build2288.tmp/wiring_analog.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_digital.c -o/tmp/build2288.tmp/wiring_digital.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_pulse.c -o/tmp/build2288.tmp/wiring_pulse.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_serial.c -o/tmp/build2288.tmp/wiring_serial.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_shift.c -o/tmp/build2288.tmp/wiring_shift.c.o
hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /tmp/build2288.tmp/Temporary_7529_3493.cpp -o/tmp/build2288.tmp/Temporary_7529_3493.cpp.o

In function 'void nunchuck_init_with_power()':
In function 'void nunchuck_print_data()':



And with the fix from mikalhart:
Code: [Select]
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/pins_arduino.c -o/tmp/build43787.tmp/pins_arduino.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/WInterrupts.c -o/tmp/build43787.tmp/WInterrupts.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring.c -o/tmp/build43787.tmp/wiring.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_analog.c -o/tmp/build43787.tmp/wiring_analog.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_digital.c -o/tmp/build43787.tmp/wiring_digital.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_pulse.c -o/tmp/build43787.tmp/wiring_pulse.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_serial.c -o/tmp/build43787.tmp/wiring_serial.c.o
hardware/tools/avr/bin/avr-gcc -c -g -Os -w -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/wiring_shift.c -o/tmp/build43787.tmp/wiring_shift.c.o
hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /tmp/build43787.tmp/Temporary_9787_425.cpp -o/tmp/build43787.tmp/Temporary_9787_425.cpp.o
hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/HardwareSerial.cpp -o/tmp/build43787.tmp/HardwareSerial.cpp.o
hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/Print.cpp -o/tmp/build43787.tmp/Print.cpp.o
hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -mmcu=atmega168 -DF_CPU=16000000L -I/Developer/Applications/arduino-0012/hardware/cores/arduino -I/Developer/Applications/arduino-0012/hardware/libraries/Wire /Developer/Applications/arduino-0012/hardware/cores/arduino/WMath.cpp -o/tmp/build43787.tmp/WMath.cpp.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/HardwareSerial.cpp.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/pins_arduino.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/Print.cpp.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/WInterrupts.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring_analog.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring_digital.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring_pulse.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring_serial.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/wiring_shift.c.o
hardware/tools/avr/bin/avr-ar rcs /tmp/build43787.tmp/core.a /tmp/build43787.tmp/WMath.cpp.o
hardware/tools/avr/bin/avr-gcc -Os -mmcu=atmega168 -o /tmp/build43787.tmp/WiiChuckSpike.elf /Developer/Applications/arduino-0012/hardware/libraries/Wire/Wire.o /Developer/Applications/arduino-0012/hardware/libraries/Wire/utility/twi.o /tmp/build43787.tmp/Temporary_9787_425.cpp.o /tmp/build43787.tmp/core.a -L/tmp/build43787.tmp -lm
hardware/tools/avr/bin/avr-objcopy -O srec -R .eeprom /tmp/build43787.tmp/WiiChuckSpike.elf /tmp/build43787.tmp/WiiChuckSpike.rom
hardware/tools/avr/bin/avr-objcopy -O ihex -R .flash /tmp/build43787.tmp/WiiChuckSpike.elf /tmp/build43787.tmp/WiiChuckSpike.hex
Binary sketch size: 5094 bytes (of a 14336 byte maximum)


If I can help more let me know.

noisymime

I've just upgraded to ubuntu jaunty and am now experiencing this issue. The arduino IDE is not producing any error details at all. Sometimes I will get no output whatsoever, just a red bar indicating an error, other times I will get something like this on the cmd line:
Code: [Select]
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring_shift.c -o/tmp/build4110612264017401431.tmp/wiring_shift.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/WInterrupts.c -o/tmp/build4110612264017401431.tmp/WInterrupts.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring_digital.c -o/tmp/build4110612264017401431.tmp/wiring_digital.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring.c -o/tmp/build4110612264017401431.tmp/wiring.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/pins_arduino.c -o/tmp/build4110612264017401431.tmp/pins_arduino.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring_analog.c -o/tmp/build4110612264017401431.tmp/wiring_analog.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring_pulse.c -o/tmp/build4110612264017401431.tmp/wiring_pulse.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /home/josh/Desktop/arduino-0015/hardware/cores/arduino/wiring_serial.c -o/tmp/build4110612264017401431.tmp/wiring_serial.c.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -I/home/josh/Desktop/arduino-0015/hardware/cores/arduino -Ihardware/libraries/EEPROM -Ihardware/libraries/Wire -Ihardware/libraries/TimerOne /tmp/build4110612264017401431.tmp/Temporary_9332_120.cpp -o/tmp/build4110612264017401431.tmp/Temporary_9332_120.cpp.o

20,
20,
In function 'void calibrate()':
In function 'void draw_primary_headings()':
In function 'void draw_secondary_headings()':
In function 'void redraw_lcd()':


This is using arduino-0015 with the build.verbose option turned on. The same problem occurs with arduino-0011 and 12. Its very frustrating, makes finding a problem nearly impossible.

The Clever Monkey

I looked briefly at how the IDE reports compiler messages back to the UI, and there is room for improvement there.  I'm actually surprised it works at all in some cases!  This was on my todo list for one of these weekends, but...

But, this is almost certainly a bug, and almost certainly a thread contention issue.
I yield() for co-routines.

Go Up