1

I'm trying to use map for a project on an Atmel SAME70 ARM chip using Atmel Studio. I know that the STL isn't enabled for the AVR chips. But I've seen various posts around the web claiming that the ARM chips do have access to the STL.

When typing it out, the Intellisense autocomplete triggers and seems to recognize map:

Intellisense recognition

No idea why there's a pic of a tomato there, but everything works as expected up until that point. However, when I complete the line, I receive two errors and a warning:

Errors

Errors:

Error       [N] 1054 : expected ';' after top level declarator       FCM_Test   C:\Users\kyle\Documents\Atmel Studio\7.0\FCM_Test\FCM_Test\src\main.c   692
Error       [N]   10 : expected identifier or '('                    FCM_Test   C:\Users\kyle\Documents\Atmel Studio\7.0\FCM_Test\FCM_Test\src\main.c   692
Warning     [N] 3306 : declaration specifier missing, defaulting to 'int'   FCM_Test    C:\Users\kyle\Documents\Atmel Studio\7.0\FCM_Test\FCM_Test\src\main.c   692

I've tried passing --specs=nosys.specs to the linker but that didn't seem to help. What am I missing or doing wrong here?

embedded.kyle
  • 10,976
  • 5
  • 37
  • 56
  • The issue of `std::map` is that it uses *dynamic memory allocation*, which is frowned upon on memory constrained platforms, such as embedded systems. Many embedded systems can't handle memory fragmentation and their is no garbage collection in C++. – Thomas Matthews Apr 27 '17 at 21:02
  • BTW, the STL has nothing to do with the platform chip. You can have an AVR platform that has lots of memory and can be reset, so memory fragmentation may be less of a concern. – Thomas Matthews Apr 27 '17 at 21:03
  • I'm working on a platform that uses ARM Cortex A8 processor, but we don't allow dynamic memory allocation; which means no `std::map` (although we could write a custom allocator for `std::map`). – Thomas Matthews Apr 27 '17 at 21:05
  • @ThomasMatthews I fully understand the system limitations and the precautions I will need to take to use `map` in my project. The choice of `map` is not the issue here. What I don't understand and what is an issue, is whether or not Atmel Studio recognizes STL methods in general or `map` specifically. I can find `map.h` in the programs folders so it is there. But why won't it compile and link properly? – embedded.kyle Apr 27 '17 at 21:08
  • 1
    @embedded.kyle `map.h` is not the header. The standard header is `` – PaulMcKenzie Apr 27 '17 at 21:44
  • @PaulMcKenzie You are correct. And both exist in the file system. However, Atmel Studio does not recognize ``. But it will recognize ``. I thought it was a quirk. But even though it doesn't complain when I use ``, it still complains when I try to use `map` as above. What is the proper way to get Atmel Studio to let me use `map` or any other STL method? – embedded.kyle Apr 27 '17 at 21:49
  • Maybe your #include path's are not pointing to the right directory? Never used Atmel Studio, but might be something to check out. – PaulMcKenzie Apr 27 '17 at 21:54
  • @PaulMcKenzie Atmel Studio is just a repackaged version of Visual Studio. Even says "powered by Visual Studio" on the splash. I'll double check the include paths tomorrow. I figured since it took `#include ` and Intellisense picked it up, then it had the paths straight. But maybe not. – embedded.kyle Apr 27 '17 at 21:57

0 Answers0