chao.zhang Posted November 6, 2012 Posted November 6, 2012 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?
chao.zhang Posted November 6, 2012 Author Posted November 6, 2012 when i remove the UNIGINE_API macro, it compiles. But I need export this class to engine dll and use in main application.
frustum Posted November 7, 2012 Posted November 7, 2012 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.
Recommended Posts