0

I just got the last assimp SDK, and made a project, I linked it corectly ( no errors with linking ) But I seem to have some troubles with the Sample project. To be more specific the SimpleOpenGL one. I am using C++ combined with OpenGL and visual studio 10.

struct aiVector3D scene_min, scene_max, scene_center;

The line above creates the following errors.

1>main.cpp(25): error C2371: 'aiVector3D' : redefinition; different basic types
1>d:\libraries\assimp--3.0.1270-sdk\include\assimp\vector3.h(124) : see declaration of 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_min' uses undefined struct 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_max' uses undefined struct 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_center' uses undefined struct 'aiVector3D'

There are more errors but I will post them if they still appear after I solve this one.

Edit due to comment

Looks like that works! Thnx. But could you explain why the word struct wouldn't affect the program in C?

Community
  • 1
  • 1
taigi tanaka
  • 299
  • 1
  • 4
  • 17

1 Answers1

2

You have to remove the word struct from your definitions because aiVector3D is differently declared in the header file.

In the linked header file you see the line #ifdef __cplusplus which is used by the preprocessor for conditional compilation. This means that everything until the next #else will be compiled into the object file if you use a C++ compiler. And this code tells us that aiVector3D is a typedef (= other name) for aiVector3t<float>.

If you use a plain C compiler the declaration of aiVector3D is

struct aiVector3D {
    float x,y,z;
}

and this would fit your defintions.

halex
  • 16,253
  • 5
  • 58
  • 67