Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am using IAR Workbench for programming my stm32f4 Discovery board and am having trouble using functions like malloc from stdlib.h file which is present in this path: IAR Systems\Embedded Workbench 7.0\arm\inc\c. Immediately after I include and try to compile the program, I get a few error messages as follows:

Error[Pe040]: expected an identifier C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\c\stdlib.h 97

Error[Pe018]: expected a ")" C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\c\stdlib.h 97

However, when I am including stdio.h from the same location, I seem to be facing no issues. Could someone please let me know what I could be missing.

Can you please try to create a Minimal, Complete, and Verifiable Example that exhibits the errors you have? Maybe you have some error before you include that header file? Some programmer dude Sep 25, 2015 at 6:44 Share your include. Using "" or <>? Have a look in the headerfile, if there is a failure. Include paths are already known in the project (compiler/ linker) ? By the way you should not use functions like malloc on embedded hardware. user1038155 Sep 25, 2015 at 6:46 the includes are #include <stdio.h> and #include <stdlib.h> Using stdio isn't posing an issue. Only stdlib has a problem which I don't seem to realise why. Which equivalent of malloc should I be using for embedded hardware @Miguel13366? smyslov Sep 25, 2015 at 6:50 @smyslov: If you don`t use an RTOS it is not casual to allocate memory dynamically on embedded hardware. I do not know your application, so i can not say, how to solve it in an other way. Do you have your problem only with malloc or even other commands? Is malloc defined there? You should post the file, where the problem occurs as @Joachim Pileborg says. user1038155 Sep 25, 2015 at 9:05

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .