Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Macro Indicating NIOS Compilation?

In my code I can do something like:


# ifdef _WIN32
....
# endif

To only include code on a Windows target. Is there a similar symbol that is automatically defined by the NIOS IDE when compiling? I am making a library that I am debugging on Windows and would like to include both NIOS and Windows code separated in this manor, and I would prefer an automatic symbol over a custom made one.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can define any symbol you want in the build->preprocessor options.

    If you don't want to add extra symbols and use default project settings, I think you can exploit ALT_DEBUG and ALT_RELEASE.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You can define any symbol you want in the build->preprocessor options.

    If you don't want to add extra symbols and use default project settings, I think you can exploit ALT_DEBUG and ALT_RELEASE.

    --- Quote End ---

    Those might be good... for extra portability across projects I would rather it be something default as opposed to something we assigned.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    RTFM:

    Try: gcc -E -dM empty_file.c

    __NIOS2__

    --- Quote End ---

    I RTFM, however this detail somehow managed to escape my memory (weird right?)...

    Anyways that's what I wanted so I'll let you're smugness slide... This time...