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 [BUG] unwanted object files are generated and linked (Read 756 times)
yet-another-average-joe
Junior Member
**
Offline


Posts: 27
Joined: Jul 27th, 2019
[BUG] unwanted object files are generated and linked
Aug 29th, 2019 at 11:02am
Print Post  
Hello,

consider such a code in a file :

Code (C++)
Select All
#ifdef __OPTION__
#include <lib1.h>
#else
#include <lib2.h>
#endif
 



lib1 and lib2 are 2 variants of the same code, with the same ctors and funcs, same parameters, same static local variables etc.

The precompiler option is not taken into account, and both libraries get compiled/linked, generating an error for each and every function (multiple definition)

This can be seen in the Release/Debug subfolders.

The problem only occurs with VisualMicro, the code always compiles fine in Arduino IDE. I use Visual Studio 2017 + VisualMicro 1.1908.5

Workaround : commenting out the offending #includes solves the problem, but it is an uggly fix !

I didn't see an option related to this behaviour.

When generating the makefile, VisualMicro should not include the preprocessor-excluded headers and related sources (I don't know where lives the makefile, so I didn't investigate further...)
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [BUG] unwanted object files are generated and linked
Reply #1 - Aug 29th, 2019 at 12:34pm
Print Post  
Please answer all of these questions

1) Is vMicro>Compiler>Deep Search on or off?

2) Do lib1.h and lib2. relate to arduino libraries?

3) If the answer to 2) is Yes, then are the two librares included in your solution as shared library projects or not?
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint