Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
Visual Micro >> Installation & Troubleshooting >> [BUG] unwanted object files are generated and linked
https://www.visualmicro.com/forums/YaBB.pl?num=1567076569

Message started by yet-another-average-joe on Aug 29th, 2019 at 12:02pm

Title: [BUG] unwanted object files are generated and linked
Post by yet-another-average-joe on 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...)

Title: Re: [BUG] unwanted object files are generated and linked
Post by Visual Micro on 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?

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2019. All Rights Reserved.