Sorry,
You're right I've made a mistake declaring my class but that wasn't
that I will want to understand.
But I have modified like you said, and like was the header file in the
first place.
So there is the file and the errors :
/**
* @file Vector2.h
* @brief A container with 2 components
* @author Alternative Shift (Guillaume Rous)
* @date 30/11/09
*/
#ifndef VECTOR2_H
#define VECTOR2_H
#include <math.h>
#include <typeinfo>
#include "../config/Define.h"
#include "../utilities/Utils.h"
namespace AS
{
/**
* @class CVector2
*
* @brief This class represents a vector with 2 components and its
main operations
*/
template <class T>
class CVector2
{
public :
CVector2(T _X, T _Y);
};
template <typename T>
inline CVector2<T>::CVector2(T _X, T _Y) :
X(_X),
Y(_Y)
{
}
} /* namespace AS */
#endif /* VECTOR2_H */
And there is the 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.h:28: error: expected ',' or '...' before numeric constant
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h:33: error: expected ',' or '...' before numeric constant
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h: In constructor 'AS::CVector2<T>::CVector2(T)':
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h:34: error: class 'AS::CVector2<T>' does not have any field
named 'X'
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h:35: error: class 'AS::CVector2<T>' does not have any field
named 'Y'
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h:35: error: '_Y' was not declared in this scope
make: *** [/home/gbadoual/Workspace/proj/template/android_os/android/
obj/local/armeabi/objs-debug/opengl/opengl.o] Erreur 1
I want to know how to use template for Android NDK.
Because I try to port a code who was functionnal for C++ Compiler
(Unix), and for iPhone.
But I want to understand why the use of template, that I had before
doesn't work with the Android Compiler
On 9 mai, 10:05, Kostya Vasilyev <[email protected]> wrote:
> See below:
>
> 09.05.2011 11:45, Grégoire Badoual пишет:
>
> > namespace AS
> > {
> > /**
> > * @class CVector2
> > *
> > * @brief This class represents a vector with 2 components and its
> > main operations
> > */
> > template<class T>
> > class CVector2
> > {
> > public :
>
> > template<class T> CVector2<T>::CVector2(T _X, T _Y);
>
> The above declaration is wrong, it should be simply:
>
> CVector2(T _X, T _Y);
>
> All the other stuff is not needed: while inside the declaration of class
> CVector2, the compiler already know that: 1) it's a class template 2) T
> is a template parameter, and is a class.
>
> http://www.codersource.net/c/c-tutorial-on-templates/c-class-template...
>
> That being said, this is a question possibly for android-ndk, or
> preferably for some C++ forum or mailing list.
>
> -- Kostya
>
> > };
>
> > template<class T>
> > inline CVector2<T>::CVector2(T _X, T _Y) :
> > X(_X),
> > Y(_Y)
> > {
>
> > }
>
> > } /* namespace AS */
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
--
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