Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
[BUG] unwanted object files are generated and linked (Read 118 times)
yet-another-average-joe
Junior Member
**
Offline



Posts: 14
[BUG] unwanted object files are generated and linked
Aug 29th, 2019 at 12:02pm
 
Hello,

consider such a code in a file :

Code (C++):
#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
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: [BUG] unwanted object files are generated and linked
Reply #1 - Aug 29th, 2019 at 1:34pm
 
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 Topic Print