画像をグレースケール化し、合計の輝度値を算出する関数であるMファイル(fuction_type_2.m)
function sum_gray = function_type_2(I)
gray = rgb2gray(I);
sum_gray = sum(gray, 'all');
をMATLAB CoderでC++ソースコードファイルに変換しました。(入力Iの型:uint8 2592 x 1944 x 3 )
変換されたコードはzip化したファイルとして添付しております。
コマンドプロンプトにて、
C:\Users\ .. .. \codegen\lib\function_type_2>
C:\Users\ .. .. \codegen\lib\function_type_2>
を実行して、test.exeという実行ファイルを作成しようとしたところ、
C:\Users\ .. .. \codegen\lib\function_type_2>
C:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: function_type_2.o:function_type_2.cpp:(.text+0x27): undefined reference to `rgb2gray_tbb_uint8'
collect2.exe: error: ld returned 1 exit status
「`rgb2gray_tbb_uint8' が定義されていないよ」というエラーが出ました。
しかし実際には、function_type_2.cppにおいて、
// Include Files
#include "function_type_2.h"
#include "libmwrgb2gray_tbb.h"
を呼び出しており、libmwrgb2gray_tbb.hにおいても、
EXTERN_C LIBMWRGB2GRAY_TBB_API void rgb2gray_tbb_uint8(
const uint8_T* inputImage,
const real64_T numPixels,
uint8_T* outputImage,
const boolean_T isColumnMajor);
と定義されています。
なぜこのようなエラーが発生しているのでしょうか?
構築環境は、
言語: C++
OS: Windows 10 pro
です。