Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) initialization with {...} expected for aggregate object (Read 9243 times)
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
initialization with {...} expected for aggregate object
Feb 2nd, 2018 at 9:14pm
Print Post  
Hi!
So i am running Visual Studio 15.5.5 with Arduino 1.8.5 and Release 1801.27 of Visual Micro. When using the U8U2 library and trying to declare a custom font like so:

Code (C++)
Select All
static const uint8_t u8g2_font_ArialR10_tf[1013] U8G2_FONT_SECTION("u8g2_font_ArialR10_tf") =
    "a\0\3\2\4\4\3\4\5\12\11\0\376\7\376\7\376\1I\2\241\3\334 \5\0\304\11!\7q\305"
    204"
    "Z\242T\266\10%\17w\305\234,iJjIQ\211\222R\5&\15w\304\253-\12\215Q\262I\213";
 



The IDE is giving me "initialization with {...} expected for aggregate object" with red text, i uploaded an image showing too.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: initialization with {...} expected for aggregate object
Reply #1 - Feb 2nd, 2018 at 10:48pm
Print Post  
Hi.

Which arduino ide version, board and tool chain version are you using?

  
Back to top
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: initialization with {...} expected for aggregate object
Reply #2 - Feb 2nd, 2018 at 11:42pm
Print Post  
Arduino 1.8.5, Sparkfun Pro Micro, (GCC) 4.9.2

Here is the boards manager link:
https://github.com/sparkfun/Arduino_Boards/blob/master/IDE_Board_Manager/package...

Im compiling the 16mhz version

EDIT:
The code compiles fine btw, so it's just an editor issue Smiley
« Last Edit: Feb 3rd, 2018 at 8:45pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: initialization with {...} expected for aggregate object
Reply #3 - Feb 3rd, 2018 at 9:06pm
Print Post  
Is U8G2_FONT_SECTION() from a library? Which one?

can you provide simple example that should compile but intellisense fails?
« Last Edit: Feb 3rd, 2018 at 9:06pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: initialization with {...} expected for aggregate object
Reply #4 - Feb 3rd, 2018 at 9:22pm
Print Post  
Hi!

It's the U8G2 library for monochrome displays. I downloaded it from the arduino library manager.

Here is an example, and showing in the screenshot that it compiles fine but intellisense fails:
Code (C++)
Select All
#include <U8g2lib.h>

// Arial 18 Bold (70,74,77,80,86,101,104,110,111,116,117,120)
static const uint8_t u8g2_font_ArialB18_tf[224] U8G2_FONT_SECTION("u8g2_font_ArialB18_tf") =
202e"
"x\316\0J\14\331\326\236\237\315\314X\316\212\0M\32\335\377 EM\323\206\42\305D\212\211\24\23)"
"FCFCFCfa\3P\25\332\347@Ji\64|\70A\32\7\30\7\30\7\30\7\30\7V "
\17"
1\337\30!i"
\66oE\4u"
";

U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, 1, 2, 3);

void setup()
{
    u8g2.begin();
}

void loop()
{
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_ArialB18_tf);
    u8g2.drawStr(58, 18, "Visual Micro");
    u8g2.sendBuffer();
    delay(1000);
}

 

« Last Edit: Feb 3rd, 2018 at 9:26pm by Johnex™ »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: initialization with {...} expected for aggregate object
Reply #5 - Feb 4th, 2018 at 1:58am
Print Post  
Interesting. Do you know which file U8G2_FONT_SECTION is defined in?
  
Back to top
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: initialization with {...} expected for aggregate object
Reply #6 - Feb 4th, 2018 at 9:49am
Print Post  
It gets defined in u8g2.h like so:

Code (C++)
Select All

#define U8G2_FONT_SECTION(name) U8X8_FONT_SECTION(name)

 



and then if we continue to follow it then in u8x8.h:

Code (C++)
Select All

#ifdef __GNUC__
#  define U8X8_NOINLINE __attribute__((noinline))
#  define U8X8_SECTION(name) __attribute__ ((section (name)))
#  define U8X8_UNUSED __attribute__((unused))
#else
#  define U8X8_SECTION(name)
#  define U8X8_NOINLINE
#  define U8X8_UNUSED
#endif

#if defined(__GNUC__) && defined(__AVR__)
#  define U8X8_FONT_SECTION(name) U8X8_SECTION(".progmem." name)
#  define u8x8_pgm_read(adr) pgm_read_byte_near(adr)
#  define U8X8_PROGMEM PROGMEM
#endif

#if defined(ESP8266)
uint8_t u8x8_pgm_read_esp(const uint8_t * addr);   /* u8x8_8x8.c */
#  define U8X8_FONT_SECTION(name) __attribute__((section(".text." name)))
#  define u8x8_pgm_read(adr) u8x8_pgm_read_esp(adr)
#  define U8X8_PROGMEM
#endif



#ifndef U8X8_FONT_SECTION
#  define U8X8_FONT_SECTION(name)
#endif

 

  
Back to top
 
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: initialization with {...} expected for aggregate object
Reply #7 - Feb 8th, 2018 at 9:52am
Print Post  
Any updates on this? Have you had time to take a look at it?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: initialization with {...} expected for aggregate object
Reply #8 - Feb 9th, 2018 at 1:18am
Print Post  
Ill try to look at the weekend. I expect we need an intellisense redefine because VS doesn't understand some gcc syntax but I will look.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint