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
Normal Topic Error defining multiline macro with concatenate operator ## (Read 2224 times)
jmpmscorpii
Newbies
*
Offline


Posts: 3
Joined: Oct 10th, 2018
Error defining multiline macro with concatenate operator ##
Oct 10th, 2018 at 6:40am
Print Post  
Hi.

I have installed Visual Micro extension v1810.4.0. After that I have opened an arduino project I had working. This project contains next macro definition

Code (C++)
Select All
#define buildTube(id) \
Tube tube##id ( ptrValve##id , ptrPressureTransducer##id)
 



When I have tried to compile it, console output showed an error like:

dl-190.ino: 41:10: error: stray '##' in program
   Tube tube##id ( ptrValve##id , ptrPressureTransducer##id)

However, If I delete backslash and define macro in one line

Code (C++)
Select All
#define buildTube(id) Tube tube##id ( ptrValve##id , ptrPressureTransducer##id)
 



build works as expected and success is shown at console.

If I try to compile this project with Arduino IDE and VSCode with arduino plugin, build process runs without error.

What could be the reason?

I need the ability to define multiline macro because I have many others bigger.

Thanks and regards.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error defining multiline macro with concatenate operator ##
Reply #1 - Oct 10th, 2018 at 1:05pm
Print Post  
Hi,

Please confirm if vmicro>compiler>deep search is enabled and also confirm the arduino ide version

Thanks
  
Back to top
IP Logged
 
jmpmscorpii
Newbies
*
Offline


Posts: 3
Joined: Oct 10th, 2018
Re: Error defining multiline macro with concatenate operator ##
Reply #2 - Oct 10th, 2018 at 6:08pm
Print Post  
Hi and thanks for reply.

VMicro -> Compiler -> Deep Search is enabled. Arduino IDE version is 1.8.7. I forgot to say that I have Visual Studio 2017 Community Edition (version 15.8.6).

Regards.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error defining multiline macro with concatenate operator ##
Reply #3 - Oct 20th, 2018 at 6:02pm
Print Post  
Do you have this issue in "Release" build mode?
  
Back to top
IP Logged
 
jmpmscorpii
Newbies
*
Offline


Posts: 3
Joined: Oct 10th, 2018
Re: Error defining multiline macro with concatenate operator ##
Reply #4 - Oct 22nd, 2018 at 2:00pm
Print Post  
Hi.

I have tested with Release option just now and same error is shown.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error defining multiline macro with concatenate operator ##
Reply #5 - Oct 23rd, 2018 at 8:22pm
Print Post  
This will be resolved when we add support for better prototype extraction and ctags over the next few months. In the meantime please try to put these defs in a .h files then #include that in the .ino

Thanks for the report.
« Last Edit: Oct 23rd, 2018 at 8:22pm by Tim@Visual Micro »  
Back to top
IP Logged
 
jmpmscorpii
Newbies
*
Offline


Posts: 3
Joined: Oct 10th, 2018
Re: Error defining multiline macro with concatenate operator ##
Reply #6 - Oct 24th, 2018 at 10:58pm
Print Post  
Ok, I'll do it.

Thanks for your responses.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint