Unable to interpret fixed size array, matlab compiler

I have two lines of c++ code that I'm trying to interface through matlab. (1) does not work, but (2) works - why is that? I need to use (1).
(1)
typedef unsigned short uint16;
const uint16 kLevels = 256;
bool SetTable(const float (*newLut)[kLevels]);
(2)
enum
{
kLevels = 256;
};
bool SetTable(const float (*newLut)[kLevels]);
matlab calling routine:
table1 = zeros(1,256);
[flag] = calllib(libName,'SetTable', single(table1));
error is:
Error using loadlibrary (line xxx)
: error
C2057: expected constant expression
: error
C2466: cannot allocate an array of constant size 0
I have no problem using the uint16 in other places. Is the compiler not understanding this function definition?

Antworten (1)

Walter Roberson
Walter Roberson am 17 Sep. 2015
You wrote
const unit16 kLevels = 256;
instead of
const uint16 kLevels = 256;

1 Kommentar

NIKHIL
NIKHIL am 17 Sep. 2015
Sorry..that was a typo while asking the question. I have corrected the spelling mistake. The question still stands

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Types finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 17 Sep. 2015

Kommentiert:

am 17 Sep. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by