This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM: How to get project name for preprocessor

Hi all,

I'm wonder is possible to get project name for preprocessor commands as define (ie. #ifdef...)
like compilation date/time by using "__DATE__" & "__TIME__".

Greetings,
Lukasz.

Parents
  • Hi Kevin, In the Project->Options->User->Run User Programs Before Build/Rebuild add a command of:
    PreProcess.Bat "@L"

    Could you help tell me why the file "MyProjectName.h" is not created?

    [Build Message]
    Build Project 'bootloader' - Target 'Bootloader Configuration'
    Before Build - User command #1: E:\2015NewLife\EVT1\Application\Projects\bootloader\src\preprocess.bat "bootloader"
    E:\2015NewLife\EVT1\Application\Projects\bootloader>echo #define PROJECT_NAME "bootloader" 1>MyProjectName.h
    compiling main.c...
    E:\2015NewLife\EVT1\Application\Projects\bootloader\src\main.c(55): error: #5: cannot open source input file "MyProjectName.h": No such file or directory #include "MyProjectName.h"
    src\main.c: 0 warnings, 1 error
    ".\output\bootloader.axf" - 1 Error(s), 0 Warning(s).
    Target not created.

Reply
  • Hi Kevin, In the Project->Options->User->Run User Programs Before Build/Rebuild add a command of:
    PreProcess.Bat "@L"

    Could you help tell me why the file "MyProjectName.h" is not created?

    [Build Message]
    Build Project 'bootloader' - Target 'Bootloader Configuration'
    Before Build - User command #1: E:\2015NewLife\EVT1\Application\Projects\bootloader\src\preprocess.bat "bootloader"
    E:\2015NewLife\EVT1\Application\Projects\bootloader>echo #define PROJECT_NAME "bootloader" 1>MyProjectName.h
    compiling main.c...
    E:\2015NewLife\EVT1\Application\Projects\bootloader\src\main.c(55): error: #5: cannot open source input file "MyProjectName.h": No such file or directory #include "MyProjectName.h"
    src\main.c: 0 warnings, 1 error
    ".\output\bootloader.axf" - 1 Error(s), 0 Warning(s).
    Target not created.

Children