Arduino Programmed from eclipse does nothing

Hey All,

Hope this is the right forum, but here goes. I’ve used the description on http://www.arduino.cc/playground/Code/Eclipse to get everything up and running in Eclipse. To be complete, I run Ubuntu 11.04 with Eclipse 3.6.2
Now here’s the weird part. When I create a main.cpp file the way suggested, i get no compile errors whatsoever. Uploading to the arduino all goes well, but then comes the weirdness. Without changes to the code, different uploads give different results. Here’s what is supposed to happen:
led 13 should blink on and off (every 750 ms) an every second “loop” should be written on Serial. Whta happens is that after upload sometimes pin 13 blinks, but then superfast and Serial does nothing. Most of the time however nothing happen and every pin exept the ground pin is set to HIGH (or atleast, whenever I connect a led it lights up). When I copy the setup and loop functions to an arduino sketch everything works.
Heres main.cpp:

#include <stdlib.h>
#include <WProgram.h>

unsigned long currentTime = 0;
unsigned long sendTime = 0;

void setup()
{
	Serial.begin(4800);
	pinMode(13, OUTPUT);
}

void loop()
{
	currentTime = millis();
	digitalWrite(13, (currentTime % 1500 <750) ? LOW : HIGH);
	if(currentTime - sendTime > 1000)
	{
		sendTime = currentTime;
		Serial.println("loop");
	}
}

extern "C" void __cxa_pure_virtual()
{
  cli();
  for (;;);
}

__extension__ typedef int __guard __attribute__((mode (__DI__)));

void * operator new(size_t size)
{
  return malloc(size);
}

void operator delete(void * ptr)
{
  free(ptr);
}

void * operator new[](size_t size)
{
    return malloc(size);
}

void operator delete[](void * ptr)
{
	if (ptr)
		free(ptr);
}

int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}
void __cxa_guard_release (__guard *g) {*(char *)g = 1;}
void __cxa_guard_abort (__guard *) {}

int main(void)
{
	init();
	setup();
	for(;;)
	{
		loop();
	}
	return 0;
}

I had similar problems with Eclipse. I attached a template project that works. Have a look at all the project settings.

Template.zip (25.2 KB)

Hey Maruis,

Thanks for your reply. Sorry for my late reaction, I was away for a short holiday. Your settings work well with a c project. The thing is that I need (actually, want) object oriëntation. The weird thing is that compiling gives no errors and even uploading goes well, but then, nothing...

I have experienced similar problems. I have a feeling there are linker issues here but I have not got an answer yet. Can you send me your project to see if I can find something?

I think I can. I'm doing some testing at this point, if that doesn't work out I will sent you the project.

I am using the Exclipse environment with OOP and it works. There are some of the Arduino libraries that I am having the same issues with. Like if I include NewSoftSerial then it does nothing. I am trying to find what it is still. However I am busy on another projects and this one will have to way for a week or two. Once I find something I will let you know and visa-versa of coarse.