Newbie Topic - Adding header files from C standard library

Hi,

This might be a very basic thing but I am new to HEW. Please tell me how can I add a new header file (math.h) to an exsisting project? I tried to just add in the include statement but its giving me an error.

Any help will be highly appreciated.

Thanks

Kanika

  • Hey Kanika,

    What kind of include statement were you implementing?

    #include "math.h"

    Searches for the math header file in the workspace you are working within

    #include

    Searches for the math header file outside of your predefined workspace.

    Hope this helps out,

    Anthony

  • Thanks for your reply Anthony. I tried with both actually but it didn't work.

  • Sorry to be nitpicking, but this is NOT a question of HEW and should not be posted here. It is a question of the compiler you use and may be slightly different depending on the compiler in use.

    In general, the compiler should have a possibility to set the directory where to search for include files. Add the directory with math.h there.

  • Hi Kanika,

    "Didn't work" is a rather vague description.  What error were you getting "cannot find math.h", "unresolved function/symbol", etc.

    Just guessing on your problem, but remember, this is a two step issue.

    1) Include math.h  in your file so your code has the function prototypes it needs.

    2) include the math.h library in the build (Standard Library tab in the Build configuration) so the linker builds and finds the standard library code for math.h.

    Hope this helps.

    Regards,

    Kevin

  • I was getting an error for unresolved external symbol. Thanks Kevin I included math.h in the build configuration and it worked.