GLUT-对pressedButton(int,int)的未定义引用



我有一个包含glutMotionFuncmain方法,该方法接收签名为void movimentoMouseBotaoApertado(int, int)的函数movimentoMouseBotaoApertado。我有一个.h.cpp文件,但当我在主文件中导入.h并尝试执行代码时,错误显示为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
}

moviementoMouseBotoApertado.h

#ifndef MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
#define MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED
void movimentoMouseBotaoApertado(int, int);
#endif // MOVIMENTOMOUSEBOTAOAPERTADO_H_INCLUDED

moviementoMouseBotoApertado.cpp

#include <stdio.h>
void movimentoMouseBotaoApertado(int x, int y) {
printf("Botão apertado [%d,%d]", x, y);
}

我用右键点击并选择递归添加文件然后我选择了文件夹/文件并进行了操作。

最新更新