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

uint32_t undefined

uVision puzzles me a fair bit.

In my project I have declared instances of TIM_TimeBaseInitTypeDef, RCC_ClocksTypeDef, I2S_InitTypeDef without any problems.

Now I'm trying to declare an instance of DMA_InitTypeDef and get this error:

main.c(460): error: #20: identifier "uint32_t" is undefined

I am able to define the following:

#define ADC1_DR_Address ((uint32_t)0x4001244C)

which doesn't give me an error.

this is wierd so any advice?

The newbie
Thomas

  • sorry it was the

    DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;

    where ADC1_DR_Address is defined as

    #define ADC1_DR_Address ((uint32_t)0x4001244C)

    that caused the trouble.

    I'll try to continue changing it to:

    #define ADC1_DR_Address ((uint32)0x4001244C)

    Can someone please elaborate on the differenc?

    Thanks
    Thomas

  • uVision puzzles me a fair bit.

    Not really. It's the compiler, and more importantly, that code you're compiling with it, that does.

    In my project I have declared instances of TIM_TimeBaseInitTypeDef, RCC_ClocksTypeDef, I2S_InitTypeDef without any problems.

    And who outside your workplace is supposed to know what those typedefs are?

    main.c(460): error: #20: identifier "uint32_t" is undefined

    What made you think it was supposed to be pre-defined? Where do you expect that definition to come from?

  • Ok I see I take things for granted here :)

    I'm working with the uVision with an ST ARM eval board which you guys didn't know..so I see you point

    I will direct the question to the ST forum (ST shares code exmples where they use the uint32_t type)!

    Thanks for your reply

    Thomas

  • uint32_t should normally be defined in stdint.h - maybe you need to add a line:

    #include <stdint.h<
    


    early in your source file.

    Another thing. #define SYMBOL RANDOM_RUBBISH will not produce any errors since #define is handled by the preprocessor. It isn't until you get the preprocessor to expand SYMBOL that the compiler will see RANDOM_RUBBISH and can generate a compilation error.

    So a #define can contain undefined data types or variable names without any errors - unless you make use of the #defined symbol.