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)
...
#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
}
#ifndef MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
#define MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
void movimentoMouseBotaoApertado(int, int);
#endif // MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
#include <stdio.h>
void movimentoMouseBotaoApertado(int x, int y) {
printf("Botão apertado [%d,%d]", x, y);
}
I clicked with the right button and selected Add files recursively... and I chose the folders/files and worked it.