Forum Discussion

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

How to solve NIOS and C++ problem with alt_remap_uncached

I'm using NIOSII eds for an app in my SOC. I'd like to use C++, but I'm having problems even getting it started.

What am I missing here?

extern "C" {# include <stdio.h># include "system.h"# include "adxl.h"

}

int main()

{ unsigned char *padxl = (unsigned char*)alt_remap_uncached((void*)(ADXL_BASE),sizeof(unsigned char));

printf("Hello from Nios II!!!!\r\n");

return 0;

}

gives me the following error:

'alt_remap_uncached' was not declared in this scope

3 Replies

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

    Many thanks. That fixed it.

    alt_remap_uncached must have been getting included somewhere else without the alt_cache.h in the .c version because it worked fine without it. It only presented a problem when I changed it to .cpp. But when I add the sys/alt_cache that made it all work.

    Many thanks again.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In C it isn't necessary to have a function prototype in scope in order to call it, C++ does need one.

    It is a good idea to enable a lot more of the C 'warnings' and to make them fatal by adding -Wall -Werror to the command line. Some of the warnings are a bit pedantic and can be turned off individually.