Reputation: 468
I get error like this when I do ndk-build:
/Users/../handle.c:80: error: 'struct _AR2Tracking2DParamT' has no member named 'template'
/Users/../handle.c:100: error: 'struct _AR2Tracking2DParamT' has no member named 'template'
I didn't know about "template", so searched about it on google. Finally, I know it's the qualifier of C++.
But handle.c is a C file. Why does ndk-build incorrectly guess that its a C++ file?
Is there any way to specify it is a C file in Android.mk?
thanks.
2013/11/22 edit:
Sorry I put another error code. Relevant error code is the following:
-- template.h --
int ar2FreeTemplate( AR2TemplateT *template );
-- ndk-build says --
/Users/.../template.h:63: error: expected ',' or '...' before 'template'
so ndk-build incorrectly guesses that template.h is C++ header file.
If it understands that it is a C header file, it should analyze template
as a variable, not a keyword.
2013/11/25 edit:
here is template.h. I replaced "template" to "temp". So i fixed this issue for the moment.
#ifndef AR2_TEMPLATE_H
#define AR2_TEMPLATE_H
#include <AR/ar.h>
#include <AR2/config.h>
#include <AR2/imageSet.h>
#include <AR2/featureSet.h>
#ifdef __cplusplus
extern "C" {
#endif
(An omission)
AR2TemplateT *ar2GenTemplate ( int ts1, int ts2 );
int ar2FreeTemplate( AR2TemplateT *temp );
int ar2SetTemplateSub ( ARParamLT *cparamLT, float trans[3][4], AR2ImageSetT *imageSet,
AR2FeaturePointsT *featurePoints, int num,
AR2TemplateT *temp );
int ar2GetBestMatching ( ARUint8 *img, ARUint8 *mfImage, int xsize, int ysize, int pixFormat,
AR2TemplateT *mtemp, int rx, int ry,
int search[3][2], int *bx, int *by, float *val);
int ar2GetBestMatching2(void);
int ar2GetResolution( ARParamLT *cparamLT, float trans[3][4], float pos[2], float dpi[2] );
int ar2GetResolution2( ARParam *cparam, float trans[3][4], float pos[2], float dpi[2] );
int ar2SelectTemplate( AR2TemplateCandidateT *candidate, AR2TemplateCandidateT *prevFeature, int num,
float pos[4][2], int xsize, int ysize );
#ifdef __cplusplus
}
#endif
#endif
Upvotes: 0
Views: 146
Reputation: 57183
Unfortunately, template
is a reserved word in C++. Therefore, you cannot use this as identifier in C++ context, even in an h file included from C++, even if you wrap it with extren "C"
, as
extern "C" {
#include "template.h"
}
The best solution would be to change the name of parameter in template.h
. If the file is carved in stone, here is a workaround:
extern "C" {
#define template notemplate
#include "template.h"
#undef template
}
Upvotes: 1