Timer 1 Interrupt not working on Atmega1280 (Arduino Mega) [solved]

Hello guys! My first post here, hehe!

I’m programming my arduino Mega 1280 with Code Blocks and avr-gcc, and I’m trying to make the compA timer 1 interrupt work, I made this code but it isn’t work, looking the datasheet and examples it appears to be right, but nothing at the output:

#define F_CPU 16000000UL
#define __AVR_ATmega1280__

#include <avr/io.h>
#include <avr/interrupt.h>


int main (void) {
    DDRK = 255;

    TCCR1B = (1 << WGM12);
    TCCR1A = 0;
    TCCR1B |= (1 << CS10) | (1 << CS11); //| (1 << WGM12);
    OCR1A = 5000;

    TIMSK1 = (1 << OCIE1A);

    sei();

    while(1);
}


ISR(TIMER1_COMPA_vect) {
    PORTK = ~PORTK;
}

The problem appear to be at the interrupt because I made this other code to see if the timer1 is runnig propely and it is:

#define F_CPU 16000000UL
#define __AVR_ATmega1280__

#include <avr/io.h>

int main (void) {
    DDRK = 255;

    TCCR1B = (1 << WGM12);
    TCCR1A = 0;
    TCCR1B |= (1 << CS10) | (1 << CS11); 
    OCR1A = 5000;

    while(1) {
        if (TIFR1 & (1 << OCF1A)) {
            PORTK = ~PORTK;
            TIFR1 = (1 << OCF1A); //reset compA flag
        }
    }
}

Maybe I’m forgeting something with the interrupts to make it works, I think someone here can help me, hehehe.

Thanks! Grégory Gusberti (sorry my bad english, i’m brazilian)

SOLVED! I was not using the oficial code::blocks and it was mapping the RAM memory at the wrong way, I configured the oficial code::blocks with the avr-gcc and now it is working beautiful!