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.

IAR Fatal Error[Pe035]:#error directive

Other Parts Discussed in Thread: MSP430F5529

Hello,


I am using MSP430F5529 and IAR to develop a system. When I complied a program, I got an error.

Fatal Error[Pe035]:#error directive.

The code is posted as below:

#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
  #error "Which gyro are you using? Define MPUxxxx in your compiler options."
#endif


Please help. Thank you very much.

  • The code you are using needs to know which gyro you are using. It expects you to set a preprocessor symbol, e.g. MPU9150.

    You can do this from the command like using the -D option, or in en IDE.

        -- Anders Lindgren, IAR Systems

  • I think I set a preprocessor. But I'm not sure if this is correct. My complete structure is,

    #if defined MOTION_DRIVER_TARGET_MSP430

    //do something

    #elif defined EMPL_TARGET_MSP430

    //do something

    #elif defined EMPL_TARGET_UC3L0

    //do something

    #else

       #error "Gyro driver is missing the system layer implementations."         <-Got fatal error [Pe035]

    #endif

    #if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
      #error "Which gyro are you using? Define MPUxxxx in your compiler options."          <--Got fatal error [Pe035]
    #endif

    #if defined MPU9150
    #ifndef MPU6050
    #define MPU6050
    #endif

  • It's telling you that none of those symbols are set, so they do not evaluate to TRUE, and it drops to the #else condition.

    Check where those symbols are supposed to be set to make sure the proper one is being set. That could be in an include .h file or in the project settings (Project->Options->C/C++->Preprocessor in IAR menu).

  • oic, I think I should include a MPU9150 header to that .c file

  • But I am quite confused because this file is a part of the headers for the main program. That mean we should use that file directly without any modifying. I think that is not a correct usage if I need to update the including file name in the header file depends on the device which I used every time.

    For my case, do I need to update the including file name, such as #include mpu9150.h or #include mpu6050.h, in the header file?  What is the solution.


    If I want to define the mpu9150 by using "defined symbol", what should I put in the blank? #mpu9150 = ??????

    Thank you.

    Sung Ming

  • One way to do this is to place the following line before you include the header file:

        #define MPU9150

    Another way to do this in the IDE is to go to Projects -> Options -> C/C++ Compiler -> Preprocessor -> Defined symbols and add MPU9150.

        -- Anders Lindgren, IAR Systems

**Attention** This is a public forum