Yes, it was in the first place what I do but I tried to experiment
something different
to understand my mistakes.

So I have return my source code to his beginning

So I give you my .h associated :


#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 :

        template <class T> CVector2<T>::CVector2(T _X, T _Y);

    };

    template <class T>
                inline CVector2<T>::CVector2(T _X, T _Y) :
                X(_X),
                Y(_Y)
                {

                }

} /* namespace AS */

#endif /* VECTOR2_H */


And there is the mistakes associated with this header file :

Compile++ thumb  : opengl <= opengl.cpp
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: declaration of 'class T'
/home/gbadoual/Workspace/proj/template/android_os/android/jni/maths/
Vector2.h:23: error:  shadows template parm 'class T'
/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:28: error: cannot declare member function
'AS::CVector2<T>::CVector2' within 'AS::CVector2<T>'
/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:33: error: no 'AS::CVector2<T>::CVector2(T)' member function
declared in class 'AS::CVector2<T>'
make: *** [/home/gbadoual/Workspace/proj/template/android_os/android/
obj/local/armeabi/objs-debug/opengl/opengl.o] Erreur 1

That's the mistake I have in the first place, but I d'ont understand
these mistakes, because I'm not seeing what I do wrong.


On 6 mai, 23:32, TreKing <treking...@gmail.com> wrote:
> 2011/5/6 Grégoire Badoual <gregle...@gmail.com>
>
> > And can you explain me if I'm doing something wrong.
>
> In C++ templates need to be defined inline. I'm sure you can find plenty of
> information on properly declaring and defining C++ templates on the
> inter-tubes.
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to