"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

adding new c++ class

I have create a new class to manage more then one .h. When I lunch ndk-build an error occurs:

$ ndk-buildGdbserver      : [arm-linux-androideabi-4.6] libs/armeabi/gdbserverGdbsetup       : libs/armeabi/gdb.setupGdbserver      : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserverGdbsetup       : libs/armeabi-v7a/gdb.setupCompile++ arm    : ImageTargets <= ImageTargets.cppIn file included from jni/ImageTargets.cpp:15:0:C:/Android/android-ndk-r8b/platforms/android-14/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4jni/ImageTargets.cpp:98:1: error: 'partOne' does not name a type/cygdrive/c/Android/android-ndk-r8b/build/core/build-binary.mk:255: recipe for target `obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o' failedmake: *** [obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1

Any suggestion?

this is the code of GeometryObject.cpp:

#include "GeometryObject.h"GeometryObject::GeometryObject(){    vertices=NULL;    normals=NULL;    texcoords=NULL;    numvertices=0;    numnormals=0;    numtexcoords=0;}    GeometryObject::~GeometryObject(){    if (vertices!=NULL) delete [] vertices;    if (normals!=NULL) delete [] normals;    if (texcoords!=NULL) delete [] texcoords;}

this is the .h:

class GeometryObject{    public:    GeometryObject();    ~GeometryObject();       float* vertices;       float* normals;       float* texcoords;       int numvertices;       int numnormals;       int numtexcoords;};

This is the papera.h code:

// include generated arrays#import ".\papera.h"// set input data to arraysglVertexPointer(3, GL_FLOAT, 0, paperaVerts);glNormalPointer(GL_FLOAT, 0, paperaNormals);glTexCoordPointer(2, GL_FLOAT, 0, paperaTexCoords);// draw dataglDrawArrays(GL_TRIANGLES, 0, paperaNumVerts);*/unsigned int paperaNumVerts = 10020;

 

And this is the ImageTarget.cpp modified:

//Geometry ObjectGeometryObject partOne;partOne.numvertices=paperaNumVerts;partOne.numnormals=paperaNumVerts;partOne.numtexcoords=paperaNumVerts;partOne.vertices=new float[sizeof(float)*3*numvertices];partOne.normals=new float[sizeof(float)*3*numvertices];partOne.texcoords=new float[sizeof(float)*2*numvertices];memcpy(partOne.vertices, paperaVerts, sizeof(float)*3*numvertices);

AlessandroB

Wed, 11/21/2012 - 14:58

Hi, have you included your "GeometryObject.h" in ImageTargets.cpp ? 

from the error, it loos like the compiler cannot resolve Geometry partOne;

/*==============================================================================
            Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.

After a research I think I need to add something to the Android.mk file in order to compile with cgwin the new class.

Can you provide me an example for a new .cpp in the same folder of imagetarget.cpp?

 

Thanks

AlessandroB

Wed, 11/21/2012 - 16:59

Oh yes, you definitely need to updated Android.mk (sorry if I did not pointed out before, I was assuming you already did that):

so, if you open Android.mk, you'll find:

I modified the Android.mk as you suggest but the ndk-build doesn't still recognize the name type. When you say to rebuild do you mean to lunch the ndk-build from cgwin or somethinf else?

Thanks

This is my Android.mk file:

AlessandroB

Thu, 11/22/2012 - 09:45

Hi, looking better at your code it appears that you put the following lines out of any functions:

partOne.numvertices=paperaNumVerts;

partOne.numnormals=paperaNumVerts;

partOne.numtexcoords=paperaNumVerts;

partOne.vertices=new float[sizeof(float)*3*numvertices];