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.

adding my include file

Other Parts Discussed in Thread: MOTORWARE

Hi,

I have tried to add include file to project

#include "My_Settings.h"

however even though the file exist in project directory (and I can see it there)

The compilation did not succeed.

This is the error I get

subdir_rules.mk:126: recipe for target 'proj_lab11d.obj' failed
"C:/ti/motorware/motorware_1_01_00_16_new2/sw/solutions/instaspin_foc/src/proj_lab11d.c", line 66: fatal error #1965: cannot open source file "My_Settings.h"
1 catastrophic error detected in the compilation of "C:/ti/motorware/motorware_1_01_00_16_new2/sw/solutions/instaspin_foc/src/proj_lab11d.c".
Compilation terminated.
gmake: *** [proj_lab11d.obj] Error 1
gmake: Target 'all' not remade because of errors.

why ?

Thanks,

  • Ok I have managed to do the following:

    on main program added:

    #include "My_Settings.h"

    in the My_settings.h written:

    #ifndef MY_SETTINGS_H_

    #define MY_SETTINGS_H_

    #define RIGHT 0.22 // this is my variable

    #endif /* MY_SETTINGS_H_ */

    And in Build settings added:

    Now I get this error:

    >> Compilation failure
    subdir_rules.mk:126: recipe for target 'proj_lab11d.obj' failed
    "C:\ti\motorware\motorware_1_01_00_16_new2\sw\solutions\instaspin_foc\src\My_Settings.h", line 1: error #171: expected a declaration
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 62: warning #12-D: parsing restarts here after previous syntax error
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 200: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 219: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 230: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 277: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 283: error #20: identifier "__uint64_t" is undefined
    "C:/ti/motorware/motorware_1_01_00_16_new2/sw/solutions/instaspin_foc/src/proj_lab11d.c", line 435: error #20: identifier "RIGHT" is undefined
    7 errors detected in the compilation of "C:/ti/motorware/motorware_1_01_00_16_new2/sw/solutions/instaspin_foc/src/proj_lab11d.c".
    gmake: *** [proj_lab11d.obj] Error 1
    gmake: Target 'all' not remade because of errors.

    Does any one know why ?

    Thanks,

  • Roee,

    You will need to add the location of the file to the list of places that the compiler searches.

    Try going into the project properties and add the path to "My_Settings.h" to the include path list.

    Right click on your project in the Project Explorer and select properties.

    Click on include options in the tree on the left under the compiler.

    Then click the add button

    I like to use variables instead of absolute paths.  If the .h file is inside your project you can click on the workspace button.

    Then select your project

    The dialog will then look like this.  If the file is in a sub folder you could just add \path at the end

    Click OK.

    Now it should find the file when compiling.

    Regards,

    John

  • Hi Jhon
    Thanks now it finds it but gives an error:

    subdir_rules.mk:126: recipe for target 'proj_lab11d.obj' failed
    "C:\ti\motorware\motorware_1_01_00_16_new2\sw\solutions\instaspin_foc\src\My_Settings.h", line 1: error #171: expected a declaration
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 62: warning #12-D: parsing restarts here after previous syntax error
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 200: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 219: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 230: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 277: error #20: identifier "__uint64_t" is undefined
    "C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/_defs.h", line 283: error #20: identifier "__uint64_t" is undefined
    6 errors detected in the compilation of "C:/ti/motorware/motorware_1_01_00_16_new2/sw/solutions/instaspin_foc/src/proj_lab11d.c".
    gmake: *** [proj_lab11d.obj] Error 1
    'Building file: C:/ti/motorware/motorware_1_01_00_16_new2/sw/drivers/pwm/src/32b/f28x/f2806x/pwm.c'





    The file My_Settings.h is:
    #ifndef MY_SETTINGS_H_
    #define MY_SETTINGS_H_

    #define RIGHT 0.22



    #endif /* MY_SETTINGS_H_ */


    do I need to add variable :
    MY_SETTINGS_H_
    ?
    Thanks,
  • I hadn't seen your second post when I made my reply.

    I wouldn't setup that variable MY_SETTINGS_H_ in the project variables. It shouldn't be causing the build error but you don't need it. When creating a new header file the editor puts those #ifndef filename_H_H... lines in the template to prevent redefinitions. You don't need to define a variable in your project for it. Basically the variables in the project are used when you want to swap in a value for one of the items (typically a path) being passed to the compiler.

    I don't see what is wrong with tyour My_Settings.h file.

    I tweaked one of my files to look like this and it still builds ok:
    #ifndef MAIN_H_
    #define MAIN_H_

    #define RIGHT 0.22

    #endif /* MAIN_H_ */


    I am downloading MotorWare now and see if I can setup exactly what you have.

    John
  • Thanks this is strange.
    This is just a define that I have moved from the "proj_lab11d.c" to the "My_Settings.h" (just to control it from different file) - is this a problem ??
    This is not related to "MotorWare"
    Another question please:
    When I do an File-> Archive to the project, and trying to open it in new workspace some of the project files (From Motorware) are missing.
    What is the best way to Archive everything include all files -> so I will be able to open it as stand alone in another computer ?
    Thanks,
    Roee
  • Ok I have succeeded to solve the My_Settings.h
    What I did is the following:

    1. Added directory to the project called it "Mine"
    2. In This directory I have added the "My_Settings.h" file
    3. in the main program added this:
    #include "Mine/My_Settings.h"

    And now this is working and compiling OK with values from "My_Settings"

    but I still don't know how to make the EXPORT correct, since when openning it in new workspace files are missing
    Why ? and how to make this correct

    Thanks,
    Roee
  • Roee,

    I imported the proj_lab11d project into my workspace. I don't see any #define in the proj_lab11d.c file. Can you send me your .c and the .h?

    In general it is fine to move a #define from .c file into a .h file as long as the .c file includes the .h prior to the item being used.


    I will reply to the export question in the other thread.

    Regards,
    John
  • The #define are mine
    They are not original in this project - I have added them according my needs.
    Therefore you don't have them by default
    Thanks,
    Roee