Undefined symbols "_getnumcores", referenced from: _imhist in imhist.o

1 view (last 30 days)
I use matlab coder to generated the C code and call the function on my MAC running Catalina. Here is the error I got:
"Undefined symbols for architecture x86_64:
"_getnumcores", referenced from: _imhist in imhist.o
"_tbbhist_uint8", referenced from: _imhist in imhist.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
"imhist.h":
/*
* File: imhist.h
*
* MATLAB Coder version : 4.3
* C/C++ source code generated on : 12-Nov-2019 16:11:33
*/
#ifndef IMHIST_H
#define IMHIST_H
/* Include Files */
#include <stddef.h>
#include <stdlib.h>
#include "rtwtypes.h"
#include "SkyDetection_RGB_types.h"
/* Function Declarations */
extern void imhist(const emxArray_uint8_T *varargin_1, double yout[256]);
#endif
"imhist.c":
/*
* File: imhist.c
*
* MATLAB Coder version : 4.3
* C/C++ source code generated on : 12-Nov-2019 16:11:33
*/
/* Include Files */
#include "imhist.h"
#include "SkyDetection_RGB.h"
#include "libmwgetnumcores.h"
#include "libmwtbbhist.h"
#include "rt_nonfinite.h"
#include <string.h>
/* Function Definitions */
/*
* Arguments : const emxArray_uint8_T *varargin_1
* double yout[256]
* Return Type : void
*/
void imhist(const emxArray_uint8_T *varargin_1, double yout[256])
{
double numCores;
boolean_T nanFlag;
double localBins1[256];
boolean_T rngFlag;
double localBins2[256];
double localBins3[256];
int i;
int localBins2_tmp;
if (varargin_1->size[0] == 0) {
memset(&yout[0], 0, 256U * sizeof(double));
} else {
numCores = 1.0;
getnumcores(&numCores);
if ((varargin_1->size[0] > 500000) && (numCores > 1.0)) {
nanFlag = false;
rngFlag = false;
tbbhist_uint8(&varargin_1->data[0], (double)varargin_1->size[0], (double)
varargin_1->size[0], 1.0, yout, 256.0, 256.0, &rngFlag,
&nanFlag);
} else {
memset(&yout[0], 0, 256U * sizeof(double));
memset(&localBins1[0], 0, 256U * sizeof(double));
memset(&localBins2[0], 0, 256U * sizeof(double));
memset(&localBins3[0], 0, 256U * sizeof(double));
for (i = 0; i + 4 <= varargin_1->size[0]; i += 4) {
localBins1[varargin_1->data[i]]++;
localBins2_tmp = varargin_1->data[i + 1];
localBins2[localBins2_tmp]++;
localBins2_tmp = varargin_1->data[i + 2];
localBins3[localBins2_tmp]++;
localBins2_tmp = varargin_1->data[i + 3];
yout[localBins2_tmp]++;
}
while (i + 1 <= varargin_1->size[0]) {
yout[varargin_1->data[i]]++;
i++;
}
for (i = 0; i < 256; i++) {
yout[i] = ((yout[i] + localBins1[i]) + localBins2[i]) + localBins3[i];
}
}
}
}
  2 Comments
Ashish Uthama
Ashish Uthama on 11 Dec 2019
I would recommend contacting support with the repro steps (source code+config that you use to generate code), including the OS info you mention and the MATLAB version.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!