Hi,
I'm using the NDK Android, modified with crystax-r5b, with the STL
(stlport_static)
I'm trying to use the template, but i'm facing with some errors that I
don't understand.
So I have write a .cpp file with a easy use of template
#include "Vector2.h"
/* functions for vectors */
namespace AS
{
template <class T>
CVector2<T>::CVector2(T _X, T _Y) :
X(_X),
Y(_Y)
{
}
}
And a .h file associated
#ifndef VECTOR2_H
#define VECTOR2_H
#include <math.h>
#include <typeinfo>
#include "../config/Define.h"
#include "../utilities/Utils.h"
namespace AS
{
template <class T> class CVector2;
typedef CVector2<i32> TVector2i; /** int type vector */
typedef CVector2<f32> TVector2f; /** float type vector */
/**
* @class CVector2
*
* @brief This class represents a vector with 2 components and
its main operations
*/
template <class T>
class CVector2
{
public :
/**
* @brief Default constructor
*
* @param _X : x component
* @param _Y : y component
*/
CVector2(T _X = 0, T _Y = 0);
/**
* @fn void set(T X, T Y)
*
* @brief Reinitializes the vector
*
* @param _X : x axis
* @param _Y : y axis
*/
void set(T _X, T _Y);
};
} /* namespace AS */
#endif /* VECTOR2_H */
And I have these errors.
In file included from /home/gbadoual/Workspace/proj/template/
android_os/android/jni/opengl.cpp:13:
/home/gbadoual/Workspace/proj/template/android_os/android/jni/
maths/Vector2.hpp:37: error: expected ',' or '...' before numeric
constant
/home/gbadoual/Workspace/proj/template/android_os/android/jni/
maths/Vector2.hpp:48: error: expected ',' or '...' before numeric
constant
make: *** [/home/gbadoual/Workspace/proj/template/android_os/
android/obj/local/armeabi/objs-debug/opengl/opengl.o] Erreur 1
So I want to know if I can use the template with the Android NDK. I
think it's allowed, because a lot of people succeed to use template<>
with android NDK.
And can you explain me if I'm doing something wrong. I have already
checked for this errors, and some people think that's because of a
redefinition of a macro #define. But here I use a namespace, so I
think this use case is avoid.
Can you help me ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en