Thread: Cxx0030 error in microsoft visual c/c++

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    2

    Cxx0030 error in microsoft visual c/c++

    Hi all,

    Any advice is appreciated

    Here is the wrapper function in test_wrapper.c

    insert
    Code:
    #if defined(MATLAB_MEX_FILE)
    #include "tmwtypes.h"
    #include "simstruc_types.h"
    #else
    #include "rtwtypes.h"
    #endif
    /* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
    #include <math.h>
    #include <stdio.h>
    /* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
    #define u_width 1
    #define y_width 1
    
    
    /*
     * Output functions
     *
     */
    void test_Outputs_wrapper(const real32_T *x0_w,
                              const real32_T *y0_w,
                              const real32_T *z0_w,
                              const real32_T *V0_w,
                              const real32_T *Theta0_w,
                              const real32_T *Psi0_w,
                              const real32_T *Phi0_w,
                              const real32_T *Mode_w,
                              const real32_T *Time0_w,
                              const real32_T *Aero6DOF_w,
                              const real32_T *IC_w,
                              const real32_T *d3Aero_Data_w,
                              const real32_T *machx_w,
                              const real32_T *mass_data_w,
                              const real32_T *winds_w,
                              real32_T *rmode0,
                              real32_T *rmode1,
                              real32_T *rmode2,
                              real32_T *rmode3,
                              real32_T *rmode4,
                              real32_T *CMDP,
                              real32_T *PCMD,
                              real32_T *Ymiss3D,
                              real32_T *TGOout)
    {
    
    int i;
    float x0, y0, z0, V0, Theta0, Psi0, Phi0, Mode, Time0;
    float Aero6DOF[4];
    float IC[44];
    float d3Aero_Data[323];
    float machx[17];
    float met_data[100];
    float mass_data[4];
    float winds[2];
    
    x0 = *x0_w;
    y0 = *y0_w;
    z0 = *z0_w;
    V0 = *V0_w;
    Theta0 = *Theta0_w;
    Psi0 = *Psi0_w;
    Phi0 = *Phi0_w;
    Mode = *Mode_w;
    Time0 = *Time0_w;
    for(i=0;i<4;i++)
    {
        Aero6DOF[i] = *(Aero6DOF_w + i);
    }
    for(i=0;i<44;i++)
    {
        IC[i] = *(IC_w + i);
    }
    for(i=0;i<323;i++)
    {
        d3Aero_Data[i] = *(d3Aero_Data_w + i);
    }
    for(i=0;i<17;i++)
    {
        machx[i] = *(machx_w + i);
    }
    for(i=0;i<4;i++)
    {
        mass_data[i] = *(mass_data_w + i);
    }
    for(i=0;i<2;i++)
    {
        winds[i] = *(winds_w + i);
    }
    
    
    Predict_3D(x0, y0, z0, V0, Theta0, Psi0, Phi0, Mode, Time0, 
    Aero6DOF,IC , d3Aero_Data, machx,mass_data, winds,
    rmode0, rmode1, rmode2, rmode3, rmode4, CMDP, PCMD, Ymiss3D,
    TGOout);
    
    }
    
    Here is a snippet predict_3d in the file predict_3d.c.  I copied and pasted from the code
    
    #include <math.h>
    
    void Predict_3D(/*inputs...*/ float x0, float y0, float z0, float V0, 
       float Theta0, float Psi0, float Phi0, float Mode, float Time0, 
       float Aero6DOF[], float IC[], float d3Aero_Data[], float machx[], 
       float mass_data[], float winds[], 
       /*outputs...*/ float* rmode0, float* rmode1, float* rmode2,
       float* rmode3, float* rmode4, float* CMDP, float* PCMD,  float* Ymiss3D, 
       float* TGOout)
    {
       int igyro, ishot, zero_cross, i3d, rk_step, index, i;
       float t0 = 1.0;
       float y[8], y_init[8], Y_last[8], dydt[8];
       float T_last, Q, QS, QSD, K, D2V, Cl_panel, K1[8], K2[8], K3[8], K4[8], Y[8];
       float step_size, T, ratio, Data_Out[4], TTG[8], TTG3D[8];
       float Xmiss3D, Xmiss[8], Ymiss[8], temp[19], cross_span;
       float cos_Theta, cos_Psi, sin_Theta, sin_Psi;
       float temperature;
       float rho;
       float p;
       float sound;
       float mach, cd0, cd1, cd2, cd3, cd4, Cd, cp, cma, ss, tempg;
       float percent, wx, wy, g, mass, dia, area, xCd, xCypa, drftx, Ix, Iy, xt, yt;
       float sin_gtl, cos_gtl, met, xtemp, dspin, cg, pmax, drag3d, xclpnl;
       float xcrt34, roll3d, rxd, aref, h, cdc12, cdc34, cdsin, cl_panel;  
       float cda, cna, cnac, cmac, cmq, clp, cypa, cld0, cldsin, rpanel;
       float crnav, kdrift, update, xbias, cdfac, yvbias, gbias, krange, pcal;
       float xcrt12, VR, perc;
       
       
       percent = 0; Cd = 0; *TGOout = 0; wx = winds[0]; wy = winds[1]; 
       g = IC[3]; mass = mass_data[0]; dia = IC[6];
       area = IC[7]; /*aero_factor = IC[8];*/ xCd = IC[9]; xCypa = IC[10]; drftx = IC[11];
       Ix = mass_data[1]; Iy = mass_data[2]; xt = IC[15]; yt = IC[16]; cos_gtl = IC[18];
       sin_gtl = IC[19]; step_size = IC[20]; roll3d = IC[21]; met = IC[22]; 
       xtemp = IC[23]; xbias = IC[24]; update = IC[26]; crnav = IC[27]; kdrift=IC[28];
       yvbias = IC[29]; dspin = IC[30]; cg = mass_data[3]; cdfac = IC[32]; 
       krange = IC[33]; pmax = IC[34]; pcal = IC[35]; gbias = IC[36]; drag3d = IC[37];
       xclpnl = IC[38]; xcrt12 = IC[39]; xcrt34 = IC[40]; roll3d = IC[41];
       rxd = IC[42]; aref = IC[43]; rpanel = (float)0.2;
       // CMDP never changes in the Matlab code, so initialize it here for output
       *CMDP = (float)1.570797;
    
       // Set igyro to false (0) at each predictor run
       igyro = 0;
       index = 0;
    At the line wx=winds[0], the program crashed. I ran it thru the debugger in visual c 7.0.9, and i traced the winds array. In the test_wrapper call stack:

    - winds 0x00d1a76c float [2]
    [0] 0.00000000 float
    [1] 0.00000000 float
    But in the Predict_3d call stack,
    - winds 0x00000000 float *
    CXX0030: Error: expression cannot be evaluated float

    This is why the program crashed and I can't figure out why .

    I check all the other input arguments that are array in predict_3d which are Aero6DOF,IC , d3Aero_Data, machx,mass_data, winds. In the test_wrapper call stack they are defined but in the Predict_3d call stack, they are Cxx0030 like winds.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    I would think you would need to include a prototype for function Predict_3D in test_wrapper.c, or you could create a predict_3d.h, put a prototype in there, then #include "predict_3d.h" in test_wrapper.c.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM