AnsweredAssumed Answered

VisualDSP3.5 Issue porting C to C++

Question asked by Gonzo on Oct 8, 2012
Latest reply on Oct 11, 2012 by Gonzo

Hi everybody,

 

I am trying to port an existing project from C to C++. The C project compiles fine. I changed the source extensions and also the corresponding project file to pull in the renamed files. When I compile the C++ project the compiler struggels with the following code which worked ok for C:

 

enum i2cStatus sc18is600_i2csendreceive(char slaveaddress, char sendcount, char* senddata, char recvcount, char* recvdata)

{

    /// 0. Wait while I2C-bus is busy

    while (sc18is600_i2cstatus() == I2C_BUSY); 

      

    ///    1. Send a read command to I2C-bus via SPI-bus. Data will be stored in SC18IS600's internal buffer afterwards.

    if (sendcount)

    {

        const char spicmdcount = 5 + sendcount;  

        char spicommand[spicmdcount];     <--- cc0259:  error: constant value is not known spicmdcount

....

 

Here the origial command line

C:\Program Files\Analog Devices\VisualDSP 3.5 16-Bit\cc219x.exe" -c .\sc18is600.cpp -c++ -Oa -g -save-temps -path-output .\Debug -flags-compiler --diag_warning,implicit_func_decl -Wremarks -proc ADSP-21992 -o .\Debug\sc18is600.doj

".\sc18is600.cpp", line 265: cc0259:  error: constant value is not known

          char spicommand[spicmdcount];

 

Environment:

VisualDSP++ 3.5

WinXP SP runnning in VMWare 4.0.4  on Win7pro 64

ADSP 21992

 

From the compiler documentation (C/C++ Compiler and Library, Manual for ADSP-219x Processors, p1-5) I gathered that the "Variable length array support" extention is implemented in either language by VisualDSP++ 3.5.

 

Am I missing something in the settings?

 

Thanks for your help

Tobi

Outcomes