This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430F2619: QMath: How to implement #define GLOBAL_Q 12

Part Number: MSP430F2619

Tool/software: Code Composer Studio

In QMath, how to implement the #define GLOBAL_Q 12

I put this on main code and it reports error that it was duplicated coming from the library in C:\ti folder.

Is there way to override this without modifying the library. I tried what QMath manual say but it did not work.  

Thanks

  • Hi,

    Do you call this #define before you include QmathLib.h? If not, this would probably explain why it is being duplicated. It should look something like this:

    #define GLOBAL_Q 12
    #include "QmathLib.h"

    This is further explained in section 2.6 of the user's guide.

    Regards,
    Nathan
  • Yes as per manual, it did not work. It is the only c/h file that use QMath while other c/h file do not. I have look into properties to insert the statement in but could not figure out which......

    #include "0_Main/STC.h"
    #include "8_SensorMath/SensorMathQ.h"
    #include "8_SensorMath/SensorMathX.h"

    #define GLOBAL_Q 12 // Default is Q10, so we use Q12 for 16 bit Q Math. So this in
    #include "QmathLib.h"

    which produce error (after clean rebuild).

    Description Resource Path Location Type
    #48-D incompatible redefinition of macro "GLOBAL_Q" (declared at line 54 of "C:/ti/msp430/MSPWare_3_30_00_18/iqmathlib/include/QmathLib.h") SensorMathQ.c /WCOMM_1E/8_SensorMath line 39 C/C++ Problem
  • Hi,

    I would suggest calling the #define before you include any files, because one of those files may be causing QmathLib.h to be included before you think it is.

    As for adding a predefined value in the properties menu, assuming you are using CCS v7.1, go to properties->Build->MSP430 Compiler->Predefined Symbols, and add a "Pre-define NAME". If you are using a different version of CCS or IAR the procedure should be similar.

    Regards,
    Nathan
  • Yep that work, put it at the top

    //#define GLOBAL_Q 12 // Default is Q10, so we use Q12 for 16 bit Q Math. So this in
    #include "QmathLib.h"

    #include "msp430f2619.h"
    #include "0_Common/Universal_Macro.h"
    .... etc.

**Attention** This is a public forum