Migrate to Vuforia 5 (error: undefined reference)

Started by maggie, March 31, 2016, 12:03:35 PM

Previous topic - Next topic

maggie

Hi all, I'm using https://github.com/sidneibjunior/vuforia-jpct as my base, and have successfully migrated to Vuforia 3.0.9 without major problem.
Now I'm trying to migrate to Vuforia 5.0.5, but I got this error while building my codes:

[armeabi-v7a] Compile++ arm  : ImageTargetsNative <= ImageTargets.cpp
[armeabi-v7a] SharedLibrary  : libImageTargetsNative.so
jni/ImageTargets.cpp:92: error: undefined reference to 'QCAR::ObjectTracker::getClassType()'
jni/ImageTargets.cpp:159: error: undefined reference to 'QCAR::ObjectTracker::getClassType()'
jni/ImageTargets.cpp:178: error: undefined reference to 'QCAR::ObjectTracker::getClassType()'
jni/ImageTargets.cpp:190: error: undefined reference to 'QCAR::ObjectTracker::getClassType()'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libImageTargetsNative.so] Error 1

---

Has anyone ever face the same problem? Or have successfully migrate to Vuforia 5? Please help... I really need to migrate.
I have tried to follow this instruction: https://developer.vuforia.com/library/articles/Solution/How-to-Migrate-an-Android-Project
But somehow still end up in "undefined reference" error... I don't know much about C++, but I need to use the native code for my project.

Thanks in advance.

EgonOlsen

Have you included the ObjectTracker as well?

Something like:


#include <QCAR/ObjectTracker.h>


...just a guess... ???

maggie

Yes, it has been included...
Now I suspect that I need to compile ObjectTracker.h file, which I'm not really sure how to do it on this case.

EgonOlsen

Have you had a look at that particular header file? Does it actually contain the missing references?

maggie

Yes, it has getClassType(). Here is the complete content of ObjectTracker.h :


/*===============================================================================
Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved.

Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States
and other countries. Trademarks of QUALCOMM Incorporated are used with permission.

@file
    ObjectTracker.h

@brief
    Header file for ObjectTracker class.
===============================================================================*/
#ifndef _QCAR_OBJECT_TRACKER_H_
#define _QCAR_OBJECT_TRACKER_H_

// Include files
#include <QCAR/Tracker.h>

namespace QCAR
{

// Forward Declaration
class Trackable;
class DataSet;
class ImageTargetBuilder;
class TargetFinder;

/// ObjectTracker class.
/**
*  The ObjectTracker tracks ObjectTargets, ImageTargets, CylinderTargets
*  or MultiTargets contained in a DataSet.
*  The ObjectTracker class provides methods for creating, activating and
*  deactivating datasets. Note that methods for activating and deactivating
*  datasets should not be called while the ObjectTracker is working at the
*  same time. Doing so will make these methods block and wait until the
*  tracker has finished.
*  The suggested way of swapping datasets is during the execution of
*  UpdateCallback, which guarantees that the ObjectTracker is not working
*  concurrently. Alternatively the ObjectTracker can be stopped explicitly.
*  However, this is a very expensive operation.
*/
class QCAR_API ObjectTracker : public Tracker
{
public:

    /// Returns the Tracker class' type
    static Type getClassType();

    /// Factory function for creating an empty dataset.
    /**
     *  Returns the new instance on success, NULL otherwise. Use
     *  DataSet::destroyDataSet() to destroy a DataSet that is no longer needed.
     */     
    virtual DataSet* createDataSet() = 0;

    /// Destroys the given dataset and releases allocated resources.
    /// Returns false if the given dataset is currently active.
    virtual bool destroyDataSet(DataSet* dataset) = 0;

    /// Activates the given dataset.
    /**
     *  This function will return true if the DataSet was successfully
     *  activated and false otherwise.
     *  The recommended way to activate datasets is during the execution of the
     *  UpdateCallback, which guarantees that the ObjectTracker is not working
     *  concurrently.
     */   
    virtual bool activateDataSet(DataSet* dataset) = 0;
   
    /// Deactivates the given dataset.
    /**
     *  This function will return true if the DataSet was successfully
     *  deactivated and false otherwise (E.g. because this dataset is not
     *  currently active).
     *  The recommended way to deactivate datasets is during the execution of
     *  the UpdateCallback, which guarantees that the ObjectTracker is not
     *  working concurrently.
     */   
    virtual bool deactivateDataSet(DataSet* dataset) = 0;

    /// Returns the idx-th active dataset. Returns NULL if no DataSet has
    /// been activated or if idx is out of range.
    virtual DataSet* getActiveDataSet(const int idx = 0) = 0;

    /// Returns the number of currently activated dataset.
    virtual int getActiveDataSetCount() const = 0;

    /// Returns instance of ImageTargetBuilder to be used for generated
    /// target image from current scene.
    virtual ImageTargetBuilder* getImageTargetBuilder() = 0;
   
    /// Returns instance of TargetFinder to be used for retrieving
    /// targets by cloud-based recognition.
    virtual TargetFinder* getTargetFinder() = 0;

    ///  Persist/Reset Extended Tracking
    /**
     *  In persistent Extended Tracking mode, the environment map will only
     *  ever be reset when the developer calls resetExtendedTracking().
     *  This function will return true if persistent Extended Tracking
     *  was set successfully (or was already set to the specified value)
     *  and false otherwise.
     */
    virtual bool persistExtendedTracking(bool on) = 0;

    /// Resets environment map for Extended Tracking
    /**
     *  Environment map can only be reset by the developer if persistent
     *  extended tracking is enabled.
     *  This function will return true if environment map was reset
     *  successfully and false otherwise.
     */
    virtual bool resetExtendedTracking() = 0;

};

} // namespace QCAR

#endif //_QCAR_OBJECT_TRACKER_H_

EgonOlsen

No idea then. I'm not a C++ expert myself. Maybe asking this in a C++ related forum might help...

maggie

I switch everything to Java, and it works pretty well.
Here's the main part of my integration: https://github.com/TheMaggieSimpson/Vuforia559_jPCT-AE

I hope it'll be useful for some people  ;)

EgonOlsen

Quote from: maggie on April 20, 2016, 02:32:17 PM
I hope it'll be useful for some people  ;)
I'm sure it will. I'll add it to the wiki.