2012-03-16 2 views
1

라이브러리 vcglib (http://vcg.sourceforge.net/index.php/Main_Page)를 사용하는 방법을 배우려하고 있지만, 무엇이든 가장 힘든 시간을 보내고 있습니다. 엮다. 지금은 trimesh_definition.cpp를 컴파일하려고하는데, 이는 vcglib과 함께 제공되는 기본 예제 일뿐입니다. 모든 예제를 실행하고 실행하는 방법을 보여 주어야합니다.g ++로 vcglib 코드를 컴파일하는 데 도움이 필요합니다.

trimesh_definition.cpp:13:40: error: expected template-name before ‘<’ token 
trimesh_definition.cpp:13:40: error: expected ‘{’ before ‘<’ token 
trimesh_definition.cpp:13:40: error: expected unqualified-id before ‘<’ token 
trimesh_definition.cpp:14:36: error: expected template-name before ‘<’ token 
trimesh_definition.cpp:14:36: error: expected ‘{’ before ‘<’ token 
trimesh_definition.cpp:14:36: error: expected unqualified-id before ‘<’ token 
In file included from trimesh_definition.cpp:8:0: 
/home/martin/Programming/Graphics/libraries/vcglib/vcg/complex/complex.h: In instantiation of ‘vcg::tri::TriMesh<std::vector<MyVertex>, std::vector<MyFace> >’: 
trimesh_definition.cpp:16:86: instantiated from here 
(... followed by many more screenfulls of template info) 
: 나는 다음과 같은 오류를 얻을 수

g++ -I ../../../vcglib trimesh_definition.cpp -o trimesh_def 

: 나는 다음과 같은 명령을 사용하여 코드를 comipling있어

1 #include <vector> 
2 
3 #include <vcg/simplex/vertex/base.h> 
4 #include <vcg/simplex/vertex/component.h> 
5 #include <vcg/simplex/face/base.h> 
6 #include <vcg/simplex/face/component.h> 
7 
8 #include <vcg/complex/complex.h> 
9 
10 class MyEdge; 
11 class MyFace; 
12 
13 class MyVertex: public vcg::VertexSimp2<MyVertex,MyEdge,MyFace, vcg::vert::Coord3d, vcg::vert::Normal3f>{}; 
14 class MyFace: public vcg::FaceSimp2<MyVertex,MyEdge,MyFace, vcg::face::VertexRef>{}; 
15 
16 class MyMesh: public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {}; 
17 
18 int main() 
19 { 
20 MyMesh m; 
21 return 0; 
22 } 

을 : 여기

나는 comiple하기 위해 노력하고있어 코드가있다

나는 템플릿에 대해 많이 알지 못하므로 문제가 무엇인지 또는 어떻게 수정해야하는지 잘 모른다. 이것은 위에서 링크 된 vcglib 웹 사이트에서 직접 다운로드 한 코드이며, 수정하지 않았으므로 컴파일되지 않는다는 사실에 놀라움을 금치 못합니다.

대부분의 예는 Windows 컴퓨터 및 비주얼 스튜디오 용입니다. 나는 아치 리눅스를 돌리고 있는데, 이것을 g ++로 컴파일하고있다. 문제가 두 컴파일러의 차이점이 될 수 있습니까?

저는 정말로 분실했습니다. 도움을 많이 주시면 감사하겠습니다.

+1

샘플 디렉토리''qmake'를 사용하여 구축하는 데 사용됩니다 .pro' 파일을 포함하는 것 :

Tutorial는 당신에게 실제 솔루션을 제공합니다. 'qmake'를 설치하고 샘플을 빌드하는 데 사용할 수있는'Makefile'을 생성하는'qmake' 만 실행하면됩니다. 또한'.pro' 파일에서 샘플을 빌드하는 데 필요한 파일을 볼 수 있습니다. @ipc에서 지적한 것처럼 빌드중인 코드가 오래되었습니다 –

답변

1

VertexSimp2 (및 1과 3도) vcg의 이전 버전에서 사용되는 클래스입니다. Lib을 검색하면 class VertexSimp2의 정의를 찾을 수 없습니다.

이것은 정확하게 컴파일러에서 말하는 것입니다. vcg::VertexSimp2은 유형으로 예상되지만 그렇지 않습니다.

class MyUsedTypes: public vcg::UsedTypes< vcg::Use<MyVertex>::AsVertexType>, 
              vcg::Use<MyFace>::AsFaceType> 


class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3d, vcg::vertex::Normal3f> {}; 
class MyFace : public vcg::Face<MyUsedTypes, vcg::face::VertexRef> {}; 
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {}; 
+0

자습서 링크가 손상되었습니다. – xor007

관련 문제