I have a main method that contains the glutMotionFunc that receives the function movimentoMouseBotaoApertado that the signature is void movimentoMouseBotaoApertado(int, int). I have a .h and .cpp file, but when I import the .h at the main file and try to execute the code, the error appears undefined reference to movimentoMouseBotaoApertado(int, int)
main.cpp
...
#include "mouse/mouse.h"
#include "desenha/desenha.h"
...
int main(int argc, char *argv[])
{
glutInit(&argc, argv); // Always needs glutInit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
inicializa();
nomeDoPrograma();
glutDisplayFunc(desenha);
glutKeyboardFunc(teclado);
glutSpecialFunc(teclasEspeciais);
criarMenu();
glutMouseFunc(gerenciaMouse);
glutMotionFunc(movimentoMouseBotaoApertado);
glutPassiveMotionFunc(movimentoMouse);
glutReshapeFunc(alterarTamanhoJanela);
glutMainLoop(); // Redesenhando
}
movimentoMouseBotaoApertado.h
#ifndef MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
#define MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
void movimentoMouseBotaoApertado(int, int);
#endif // MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
movimentoMouseBotaoApertado.cpp
#include <stdio.h>
void movimentoMouseBotaoApertado(int x, int y) {
printf("Botão apertado [%d,%d]", x, y);
}