error message

:zipper_mouth_face: ok once more!
I have a new project consisting of one file (for the moment) and its called 'slave'
it is in the following folder path:
C:\Users\harrison\Documents\Arduino\RSS\slave

my init() function just sets things up..
and its call by loop()

void loop()
{
long packinfo = 0;
int radioid;
init(); /* call init to set things up */
for(radioid = 0;
blah, blah, blah

but I get this stupid error:
core.a(main.cpp.o): In function main': C:\Arduino\arduino-1.0\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to setup'

duh???
what in the world..

HELP Thanks
Cris H
This is Arduino 1.0 on Windows 7(64bit Ultimate)

You need a function called "setup".
You didn't post one.

and it would be a really good idea to call your init function from setup.
Then the stupid error should go away, no doubt to be replaced by another one :slight_smile:

Pete

Thank you.. works now.. I called my 'setup' function init and I called from my loop().

Its just what im used to.. (C programmers, just get older, and forget more shit than we remember) 8)

Thanks Again
Cris H.
aka Phoenixcomm.

phoenixcomm:
Thank you.. works now.. I called my 'setup' function init and I called from my loop().

That doesn't make sense.

As I understand it, you must have at least the two following functions to make the Arduino program compile correctly:

void setup()
{

}

void loop()
{

}

Without them it shouldn't work (shouldn't being the key word). What el_supremo was saying is that you should call your init() function from the setup function like so:

void setup()
{
  init();
}

If it is simple enough, you can just put your initialize activity inside the setup function. If it is complex or you will need to call it later, starting up an LCD for example that might be turned off by the code and needs to be re-initialized at some point, then your init() is a separate function and could be called from setup(). If you call init() from your loop, then you will call it repeatedly unless you use a state variable which adds unneeded complexity except in certain situations like the LCD example where a state would make sense.

I called my 'setup' function init and I called from my loop().

But Arduino already has an "init" function, called before "setup" :

#include <Arduino.h>

int main(void)
{
	init();

#if defined(USBCON)
	USB.attach();
#endif
	
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}
        
	return 0;
}