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.

bool and tBoolean undefined

Other Parts Discussed in Thread: EK-TM4C123GXL, TM4C129ENCPDT, TM4C123GH6PM

I am trying to interface a 16 X 2 LCD to the EK-TM4C123GXL launchpad board

I am getting the following error after compilation:-


#20              identifier "bool" is undefined                 sysctl.h                  /TIVA C lcd             line 596          C/C++ Problem

i have included "stdbool.h" in my program

Any other file that needs to be included?

  • Hello Prachi,

    Do you mean to say it is happening at link time? Can you send the CCS Project zipped?

    Regards

    Amit

  • Prachi Joshi said:
    i have included "stdbool.h" in my program

    The error looks to be reported from sysctl.h. Is stdbool.h included before sysctl.h in your program?

  • Hello Chester

    Good point and I believe that is the answer as well.

    However the reporter mentioned compile is OK which kind of surprised me. The error did not look to be a linker error, so wanted to double check.

    Regards

    Amit

  • Hi,

    I think the o/p should include <stdbool.h> and not "stdbool.h".

    Petrei

  • Hi Guys,
    I have the same problem.
    I included the stdbool.h as "#include <stdbool.h>"

    this is the first line of my main.c

    But I got the same error:

    "identifier "bool" is undefined"

    Any idea, what I made wrong?
  • Hello Sandor,

    Can you please paste or attach a simplified code? Also please paste the compiler logs as well.

    Regards
    Amit
  • Actually "stdbool.h" should be a superset of <stdbool.h> . IE the quoted version should also include the same directories as the angle bracket version.

    I'm not sure it's absolutely required to behave in that fashion for standards compliance but practically it is.

    However, depending on the compiler and the version of the standard they comply to bool may not be defined, I ran into that with Visual C (In the 2012 version at least bool is defined for the C++ compiler but not the C compiler).

    Robert
  • Actually it is a simple "HelloWorld" project

    In the start of the main.c I included the stdbool.h.
  • Actually it is a simple "HelloWorld" project

    And in the start of the main.c I included the stdbool.h.
  • Hello Sandor,

    Code please and compilation logs!!!

    Regards
    Amit
  • Here are the error messages:

    Description Resource Path Location Type
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 101, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\flash.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 154, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 208, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\uart.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 210, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\uart.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 211, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\uart.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 281, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\timer.h C/C++ Problem
    #20 identifier "bool" is undefined .ccsproject /copter_v01 line 585, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\sysctl.h C/C++ Problem

    .
    .
    .

    and
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 142, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 143, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 144, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 145, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 352, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\i2c.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 354, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\i2c.h C/C++ Problem
    #20 identifier "uint32_t" is undefined .ccsproject /copter_v01 line 49, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\debug.h C/C++ Problem
    #20 identifier "uint8_t" is undefined .ccsproject /copter_v01 line 142, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint8_t" is undefined .ccsproject /copter_v01 line 144, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint8_t" is undefined .ccsproject /copter_v01 line 145, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\gpio.h C/C++ Problem
    #20 identifier "uint8_t" is undefined .ccsproject /copter_v01 line 295, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\i2c.h C/C++ Problem
    #20 identifier "uint8_t" is undefined .ccsproject /copter_v01 line 297, external location: C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\i2c.h C/C++ Problem
    .
    .
    .

    and here is the code:
    /*
    * main.c
    */
    #include <stdbool.h>
    #include <inttypes.h>
    #include <math.h>
    #include <stdlib.h>
    #include <stdint.h>
    #include <stdio.h>

    #include "driverlib/cpu.h"
    #include "driverlib/fpu.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/systick.h"
    #include "driverlib/udma.h"
    #include "driverlib/i2c.h"
    #include "driverlib/uart.h"


    #include "inc/hw_gpio.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_sysctl.h"
    #include "inc/hw_types.h"

    #include "sensorlib/i2cm_drv.h"

    #include "utils/ustdlib.h"

    void main(void) {
    uint8_t out_fifo_cnt = 0;
    int pprotocol_cnt = 0;

    while(1)
    {
    case INIT:
    Init();
    programState = NEXT;
    break;
    .
    .
    .
    }
  • Hello Sandor,

    I compiled your code and it compiles w/o any errors. I am suspecting that you have missed some option during compilation. For your reference, following is the compilation options as given in the log file. Please compare and check.

    "D:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 --include_path="C:/Users/a0876236/workspace_tidesigns/tidm_tm4cusb2any_gpio_test" --include_path="D:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include" --include_path="D:/ti/TivaWare_C_Series-2.1.2.111" --advice:power=all -g --gcc --define=ccs="ccs" --define=PART_TM4C129ENCPDT --define=TARGET_IS_TM4C129_RA1 --diag_warning=225 --display_error_number --diag_wrap=off --gen_func_subsections=on --ual --preproc_with_compile --preproc_dependency="startup_ccs.pp" "../startup_ccs.c"

    Regards
    Amit
  • Hi
    Here is my "Summary of flags set:"
    -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 --include_path="D:/Program Files (x86)/CodeComposerStudio/ccsv6/tools/compiler/ti-cgt-arm_5.2.2/include" --include_path="C:/ti/TivaWare_C_Series-2.1.0.12573/sensorlib" --include_path="C:/ti/TivaWare_C_Series-2.1.0.12573/driverlib/ccs" --include_path="C:/ti/TivaWare_C_Series-2.1.0.12573" -g --float_operations_allowed=all --gcc --define=ccs="ccs" --define=TARGET_IS_BLIZZARD_RA1 --define=TARGET_IS_BLIZZARD_RA3 --define=PART_TM4C123GH6PM --display_error_number --diag_warning=225 --diag_wrap=off

    I think the main things are the same.
  • Hello Sandor

    No.

    1. PART_TM4C123GH6PM is not TARGET_IS_BLIZZARD_RA1 or RA3. It is TARGET_IS_TM4C123_RB1
    2. The options --gen_func_subsections=on --ual --preproc_with_compile are missing

    I would have to ask you to zip your project and attach it to the forum post.

    Regards
    Amit
  • copter_v01.zip

    HI Amit,

    Thank you for your answer.

    Here is my project in the zip.

    Best regards,

    Sandor

  • Hello Sandor,

    There is no C file in the zip package, no main code nor a startup file.

    Regards
    Amit
  • Hi Amit,

    Here is the complete project.

    I hope that you will find the problem.

    And thank you very much for your help.

    Best regards,

    Sandor

    7343.copter_v01.zip

  • Hello Sandor

    In the file I2C_Stellaris_API.c the following lines need to be added

    #include <stdbool.h>
    #include <stdint.h>
    #include "driverlib/sysctl.h"

    Also in the same file I2C0_MASTER_BASE, I2C1_MASTER_BASE, I2C2_MASTER_BASE and I2C3_MASTER_BASE also give an error. These need to be replaced by I2C0_BASE, I2C1_BASE, I2C2_BASE and I2C3_BASE

    In the file startup_pll.c the following lines need to be added
    #include <stdint.h>
    #include <stdbool.h>

    Regards
    Amit
  • Hi Amit,

    Yes, now my problems were solved.

    But it is really interesting, because before I did not got this error, but I used these files (2 days ago)


    Thank you very much for your help and time.

    Best regards,
    Sandor
  • Hello Sandor,

    Any small change can have caused it without you having come across it.

    Regards
    Amit
  • Hi Amit,

    I am facing the same problem, but the bugfixes you have posted do not help.

    Could you pls also review my code?

    8255.test.zip

  • Hi Amit,

    could you pls also review my code?
    Same issue...

    thanks for your help,
    Gunter
  • Hello Gunter

    Move the line

    #include <stdbool.h>
    after
    #include <stdint.h>

    and Then clean the project file and rebuild it,

    Regards
    Amit
  • Amit Ashara said:
    #include <stdbool.h>
    after
    #include <stdint.h>

    That doesn't sound right to me Amit. stdbool shouldn't depend on stdint  AFAIK. In which case include order of the two is irrelevant.

    Robert

  • Hello Robert

    stdint is the first include file and then there is jumble of other header files from TivaWare. stdbool is the last include file. I have asked the user to move the std* files to the top

    Regards
    Amit
  • Hi Amit,

    thanks for your quick support - problem solved.

    best regards Gunter
  • Hi Amit,

    I switched no completely to the TI cloud tool to configure the pins.

    Nevertheless, I am still facing problems with the comparator. (Comp0, -Input pin 13, + input int ref, output PF0)

    Could you pls review my simplified code? (attached)

    Thanks in advance,

    Gunter6366.test.zip

  • simple C issue.
    Sorry for this, my mistake... :-)
  • Hello Gunter,

    Glad you found the issue. Please note that tools like TI Pin Mux have most of these issues fixed and tested. You must use these tools for Pin Mux to reduce the chances of an error.

    Regards
    Amit