次のファイルに少し問題があります。
私はこのファイルにアークボール構造体を持っています:
#ifndef ARCBALL_H_
#define ARCBALL_H_
#include "ex1.h"
...
extern struct arcball{
float radius;
int x,y;
}arcball;
...
#endif /* ARCBALL_H_ */
そして、arcball.h ファイルを含む次の ex1.h ファイルがあります。
#ifndef __EX1_H__
#define __EX1_H__
////////////////////////////
// Project Includes
////////////////////////////
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include "arcball.h"
////////////////////////////
// OpenMesh Includes
////////////////////////////
#include "OpenMesh/Core/IO/MeshIO.hh"
#include "OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh"
////////////////////////////
// GL Includes
////////////////////////////
#include "GLee.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
...
struct arcball arcball;
#endif
ex1.h には、arcball.cpp ファイルでも使用する glut 関数のインクルードが含まれているため、ex1.h ヘッダーを含める必要があります。そして、関数を使用するために arcball.h ヘッダーを使用する必要があり、そのファイルで構造体が定義されています。
私が得るエラーは次のとおりです。
In file included from arcball.h:11:0,
from arcball.cpp:8:
ex1.h:120:16: error: aggregate ‘arcball arcball’ has incomplete type and cannot be defined
make: *** [ex1] Error 1
arcball.h ファイルを含めたので、なぜ不完全型なのかわかりません
これは相互包含の問題ですか、それとも構造体の定義/使用の問題ですか? そして、それはどのように解決できますか?
ありがとう!