We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hello, good morning everybody! i have some doubts about this, i'm using an ATMEL SAMD2 microcontroller, i'm new to this compiler and they let me handle this micro in keil uvision. I tried to make a library handling C++ language but I get these errors and this is the code:
I hope you can see the screenshots I captured, otherwise I leave the errors that marked me the compiler:
Build started: Project: Puerto 1*** Using Compiler 'V6.14', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'Build target 'Target 1'prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(241): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/ac.h(226): error: anonymous bit-field cannot have qualifiers __I uint8_t :2; /*!< bit: 2.. 3 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/ac.h(228): error: anonymous bit-field cannot have qualifiers __I uint8_t :3; /*!< bit: 5.. 7 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/ac.h(232): error: anonymous bit-field cannot have qualifiers __I uint8_t :2; /*!< bit: 2.. 3 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/ac.h(234): error: anonymous bit-field cannot have qualifiers __I uint8_t :3; /*!< bit: 5.. 7 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(242): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/adc.h(480): error: anonymous bit-field cannot have qualifiers __I uint8_t :4; /*!< bit: 4.. 7 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(243): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/dac.h(181): error: anonymous bit-field cannot have qualifiers __I uint8_t :5; /*!< bit: 3.. 7 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(244): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/dmac.h(826): error: anonymous bit-field cannot have qualifiers __I uint8_t :5; /*!< bit: 3.. 7 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(246): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/eic.h(362): error: anonymous bit-field cannot have qualifiers __I uint32_t :16; /*!< bit: 16..31 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/eic.h(366): error: anonymous bit-field cannot have qualifiers __I uint32_t :16; /*!< bit: 16..31 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(247): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/evsys.h(488): error: anonymous bit-field cannot have qualifiers __I uint32_t :4; /*!< bit: 20..23 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/evsys.h(493): error: anonymous bit-field cannot have qualifiers __I uint32_t :4; /*!< bit: 28..31 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/evsys.h(499): error: anonymous bit-field cannot have qualifiers __I uint32_t :4; /*!< bit: 20..23 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/evsys.h(501): error: anonymous bit-field cannot have qualifiers __I uint32_t :4; /*!< bit: 28..31 Reserved */ ^prueba.cpp(3): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include\samd21.h(54): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/samd21g18a.h(250): warning: In file included from...C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(316): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 2.. 3 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(319): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 6.. 7 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(322): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 10..11 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(325): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 14..15 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(329): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 2.. 3 Reserved */ ^C:/Users/uriel/AppData/Local/Arm/Packs/Keil/SAMD21_DFP/1.3.0/Device/SAMD21A/Include/component/i2s.h(331): error: anonymous bit-field cannot have qualifiers __I uint16_t :2; /*!< bit: 6.. 7 Reserved */ ^fatal error: too many errors emitted, stopping now [-ferror-limit=]20 errors generated.compiling prueba.cpp...".\Objects\Puerto 1.axf" - 19 Error(s), 0 Warning(s).Target not created.Build Time Elapsed: 00:00:01
I want to know if the microcontrollers of the ATMEL(Microchip) family support C++ language programming on keil uvision or do I have to use their ATMEL STUDIOS interface?
I hit this recently, too (on the SAMC21). ARMCLANG is built from Clang (naturally), and Clang addresses C++ DR2229 (see the list of C++ defects here). I'm not aware of a clang switch that can turn off the DR2229 fix.
The solution I chose was to use C for the functionality that needed access to the things defined in samc21.h, and call those functions from my C++ code.
Hello, Adam Lins! Thank you, I reviewed the document, so you don't add the SAMC21 library as such? or what do you call it? I didn't quite understand the solution.
I'm using the SAMC21 libraries -- I just don't include the SAMC21 header file in any C++ files, to avoid the compiler complaining about the header. I define functions in C files that use the information from the header (e.g., timer register access structures), and call those "helper" functions from the C++ code.