Avr warning sign

Can someone help us understand the warning that we keep on getting.
SPI.h:361: warning: function declaration isn’t a prototype
SPI.h:371: warning: function declaration isn’t a prototype
SPI.h:377: warning: function declaration isn’t a prototype
SPI.h:383: warning: function declaration isn’t a prototype
SPI.h:402: warning: function declaration isn’t a prototype
In file included from 50_robot_sharpIR.c:22:
SPI.c:55: warning: function declaration isn’t a prototype
Build succeeded with 32 Warnings…
Can someone please help…

What does your project file structure look like? That is to say, when you look at the left, docked AVR GCC window, what do you see listed under “Source Files”?

What you should see is something like:

Source Files

  • 50_robot_sharpIR.c
  • SPI.c

SPI.h should not be a part of this list. Your file 50_robot_sharpIR.c should have at the top the line:

#include “SPI.h”

and SPI.h should be in the same directory as SPI.c and 50_robot_sharpIR.c.

I’ve never seen this compiler warning before, so I can’t really suggest anything more without further details. Have you ever successfully created a project that included SPI.h and didn’t produce such warnings when you compiled?

- Ben

The warnings are gone now we fixxed it. Now we are having problem with the emitter and detector. There is no errors but it does not follow. I am not sure if I am putting the detector in the correct pins. I am using pins A0 and A2 for the detector in our Atmeg644.

So that I can help others who might run into that same compile problem, could you tell me what was causing it and how you fixed it?

As for the emitter/detector, there’s no such thing as “correct” pins. You can do digital input and output on all 16 of the general IO pins and you can do analog input on any of the port A pins. Whatever pins you physically connect to your sensors are the pins you should use in your code.

I recommend you troubleshoot your problem by transmitting the input you get from your sensors over serial to a terminal program such as hyperterm. You can use the sendSerial() function in SPI.c.

- Ben