Skip to content

Instantly share code, notes, and snippets.

@xerxesb
Created June 17, 2012 12:23
Show Gist options
  • Save xerxesb/2944403 to your computer and use it in GitHub Desktop.
Save xerxesb/2944403 to your computer and use it in GitHub Desktop.
My app links in a 3rd party library (QCAR)
In the top of my .cpp file I have:
#include <QCAR/TrackerManager.h>
In one of the methods of my class, i'm making the following call (which fails to link)
QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
it fails with the following error:
... /FrameMarkers.cpp:579: undefined reference to `QCAR::TrackerManager::getInstance()'
Below is the (abbreviated) definition of TrackerManager
#ifndef _QCAR_TRACKER_MANAGER_H_
#define _QCAR_TRACKER_MANAGER_H_
// Include files
#include <QCAR/Tracker.h>
namespace QCAR
{
/// TrackerManager class.
class QCAR_API TrackerManager
{
public:
static TrackerManager& getInstance();
virtual Tracker* initTracker(Tracker::TYPE type) = 0;
virtual Tracker* getTracker(Tracker::TYPE type) = 0;
virtual bool deinitTracker(Tracker::TYPE type) = 0;
};
} // namespace QCAR
#endif //_QCAR_TRACKER_MANAGER_H_
In looking at the samples in the SDK they call the exact same method, and it links without any problem...
*EDIT:* Here's the method with the line that fails, for some more context:
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkers_startCamera(JNIEnv *,
jobject)
{
LOG("Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkers_startCamera");
// Initialize the camera:
if (!QCAR::CameraDevice::getInstance().init())
return;
// Configure the video background
configureVideoBackground();
// Select the default mode:
if (!QCAR::CameraDevice::getInstance().selectVideoMode(
QCAR::CameraDevice::MODE_DEFAULT))
return;
// Start the camera:
if (!QCAR::CameraDevice::getInstance().start())
return;
// Start the tracker:
QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
QCAR::Tracker* markerTracker = trackerManager.getTracker(QCAR::Tracker::MARKER_TRACKER);
if(markerTracker != 0)
markerTracker->start();
// Cache the projection matrix:
const QCAR::CameraCalibration& cameraCalibration =
QCAR::CameraDevice::getInstance().getCameraCalibration();
projectionMatrix = QCAR::Tool::getProjectionGL(cameraCalibration, 2.0f,
2000.0f);
}
QCAR_API is defined as:
# ifdef QCAR_EXPORTS
# define QCAR_API __attribute__((visibility("default")))
# elif defined(QCAR_STATIC)
# define QCAR_API
# else
# define QCAR_API __attribute__((visibility("default")))
# endif
(note that this means nothing to me)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment