Jump to content

[SOLVED] use Unigine::Vector<class Type> template cannot compile


photo

Recommended Posts

Hello all,

 

I write a class to store the heightfield data use Unigine::Vector<class Type> template for data storage.

but it cannot compile.

 

 

My class is something like this:

 

#include <UnigineBase.h>

#include <UnigineVector.h>

 

class UNIGINE_API HeightField {

public:

/* default constructor. */

HeightField();

/* constructor with columns and rows */

HeightField(int columns, int rows);

/* default destructor. */

~HeightField();

 

protected:

/* the height field column */

unsigned int _columns;

/* the height field rows */

unsigned int _rows;

/* the height field data */

Unigine::Vector<float> _heights;

};

 

 

the compiler complains :

error C2664: “void Unigine::Vector<Type>::append(const Type &)”: cannot convert parameter 1 from “const Unigine::Vector<Type>” to “const float &”

1> with

1> [

1> Type=float

1> ]

 

 

 

 

So how to use this container template?

Link to comment

You shouldn't use UNIGINE_API macro in your classes. Because this macro is used for the engine function export.

If you need to extend the Unigine API you can use internal Vector container instead of API Unigine::Vector.

Link to comment
×
×
  • Create New...