Author Topic: Migrate to Vuforia 5 (error: undefined reference)  (Read 1000 times)

Offline maggie

  • byte
  • *
  • Posts: 13
    • View Profile
Migrate to Vuforia 5 (error: undefined reference)
« on: March 31, 2016, 12:03:35 pm »
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.
« Last Edit: March 31, 2016, 12:30:05 pm by maggie »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #1 on: March 31, 2016, 09:43:40 pm »
Have you included the ObjectTracker as well?

Something like:

Code: [Select]
#include <QCAR/ObjectTracker.h>

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

Offline maggie

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #2 on: March 31, 2016, 10:45:37 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #3 on: April 01, 2016, 07:20:49 am »
Have you had a look at that particular header file? Does it actually contain the missing references?

Offline maggie

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #4 on: April 01, 2016, 09:01:53 am »
Yes, it has getClassType(). Here is the complete content of ObjectTracker.h :

Code: [Select]
/*===============================================================================
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_

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #5 on: April 01, 2016, 10:03:13 am »
No idea then. I'm not a C++ expert myself. Maybe asking this in a C++ related forum might help...

Offline maggie

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #6 on: April 20, 2016, 02:32:17 pm »
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  ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Migrate to Vuforia 5 (error: undefined reference)
« Reply #7 on: April 20, 2016, 03:42:46 pm »
I hope it'll be useful for some people  ;)
I'm sure it will. I'll add it to the wiki.