user8401: I've trying to write my code in plain C++ dropping out the Arduino's IDE. Although I've succeed in compiling the code, whenever I try to upload it to the board it doesn't run, seems that it stucks at some unknown point.
After that, everytime I try to upload a new code to the board it stops responding and avrdude throws this message:
$ ino upload -m leonardo -p /dev/ttyACM1
/dev/ttyACM1 doesn't exist. Is Arduino connected?

It doesn't matter if I unplug and then plug again the board, that message is still showing up.
In order to restart the board, I open the Arduino IDE and then I upload any sketch, then the board comes to live again.
The first time I tried overriding the main() function and the program didn't run I thought it was the tool I was using at that moment, arduino.mk, the one that was doing something strange.
Then I tried the ino tool, but the result was the same.
I don't think avrdude is failing because it actually uploads the .hex to the board.
My original main() code was:
#include <Arduino.h>

const int LED_PIN = 13;

int main(void)
{
    pinMode(LED_PIN, OUTPUT);

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);
    }
    return 0;
}

Then I tried to mimic the one that comes with Arduino:
#include <Arduino.h>

const int LED_PIN = 13;

int main(void)
{
    pinMode(LED_PIN, OUTPUT);

#if defined (USBCON)
    USBDevice.attach();
#endif  

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);

        if (serialEventRun) serialEventRun();
    }
    return 0;
}

Sadly, with both codes the board gets stucked at some point. 
While I figure out how to solve this issue I've been exercising this solution inside a sketch:
const int LED_PIN = 13;

void setup() {                
}

void loop() {
    pinMode(LED_PIN, OUTPUT);     

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);
    }
}

Any ideas that led me to a solution? Thank you!

user8401: Solved!
It was a (big) silly mistake of my own. I overloocked the init() function right after entering the main() function. I'm shure it initializes the hardware and the entire system, so my board stucks when I skipped it.
So my code now looks like this:
#include <Arduino.h>

const int LED_PIN = 13;

int main(void)
{
    init();


#if defined (USBCON)
    USBDevice.attach();
#endif  

    pinMode(LED_PIN, OUTPUT);

    while (1)
    {

        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);

        if (serialEventRun) serialEventRun();
    }

    return 0;
}

BTW, the mix: Arduino + Vim + ino, rocks! Now I can do whatever I want from the console :)

8401: <p>I've trying to write my code in plain C++ dropping out the Arduino's IDE. Although I've succeed in compiling the code, whenever I try to upload it to the board it doesn't run, seems that it stucks at some unknown point.</p>

<p>After that, everytime I try to upload a new code to the board it stops responding and avrdude throws this message:</p>

<pre><code>$ ino upload -m leonardo -p /dev/ttyACM1
/dev/ttyACM1 doesn't exist. Is Arduino connected?
</code></pre>

<p>It doesn't matter if I unplug and then plug again the board, that message is still showing up.</p>

<p>In order to restart the board, I open the Arduino IDE and then I upload any sketch, then the board comes to live again.</p>

<p>The first time I tried overriding the main() function and the program didn't run I thought it was the tool I was using at that moment, <em>arduino.mk</em>, the one that was doing something strange.</p>

<p>Then I tried the <em>ino</em> tool, but the result was the same.</p>

<p>I don't think <em>avrdude</em> is failing because it actually uploads the .hex to the board.</p>

<p>My original main() code was:</p>

<pre><code>#include &lt;Arduino.h&gt;

const int LED_PIN = 13;

int main(void)
{
    pinMode(LED_PIN, OUTPUT);

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);
    }
    return 0;
}
</code></pre>

<p>Then I tried to mimic the one that comes with Arduino:</p>

<pre><code>#include &lt;Arduino.h&gt;

const int LED_PIN = 13;

int main(void)
{
    pinMode(LED_PIN, OUTPUT);

#if defined (USBCON)
    USBDevice.attach();
#endif  

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);

        if (serialEventRun) serialEventRun();
    }
    return 0;
}
</code></pre>

<p>Sadly, with both codes the board gets stucked at some point. </p>

<p>While I figure out how to solve this issue I've been exercising this solution inside a sketch:</p>

<pre><code>const int LED_PIN = 13;

void setup() {                
}

void loop() {
    pinMode(LED_PIN, OUTPUT);     

    while (1)
    {
        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);
    }
}
</code></pre>

<p>Any ideas that led me to a solution? Thank you!</p>
 8401: <p><strong>Solved!</strong></p>

<p>It was a (big) silly mistake of my own. I overloocked the init() function right after entering the main() function. I'm shure it initializes the hardware and the entire system, so my board stucks when I skipped it.</p>

<p>So my code now looks like this:</p>

<pre><code>#include &lt;Arduino.h&gt;

const int LED_PIN = 13;

int main(void)
{
    init();


#if defined (USBCON)
    USBDevice.attach();
#endif  

    pinMode(LED_PIN, OUTPUT);

    while (1)
    {

        digitalWrite(LED_PIN, HIGH);
        delay(100);
        digitalWrite(LED_PIN, LOW);
        delay(900);

        if (serialEventRun) serialEventRun();
    }

    return 0;
}
</code></pre>

<p>BTW, the mix: Arduino + Vim + ino, rocks! Now I can do whatever I want from the console :)</p>
