Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
Visual Micro >> Visual Studio 2017, 2019 >> Including unwanted object files
https://www.visualmicro.com/forums/YaBB.pl?num=1565201404

Message started by Bob Jones on Aug 7th, 2019 at 7:10pm

Title: Including unwanted object files
Post by Bob Jones on Aug 7th, 2019 at 7:10pm
I have a very complex build that gets compiled in different ways, depending on the device I am building. It could be a Mega-based robot, an Uno-based Remote Controller or even a Nano-based small robot. Each device has its own configuration file that defines what libraries this device needs. For example, a Robot device needs Servo.h and BJDriverL298N to control the motors. A Remote Controller, on the other hand may need code to manage a Joystick but does not need the Servo or L298N code.

The problem I am seeing is that modules I don't need (e.g. Servo) are being included in builds, thus increasing the size of the output file to the point where it is too big for the processor.

How do I instruct the linker to only include the libraries that are explicitly included in the files being compiled?

The attached zip file contains the verbose compiler output and the generated object file contents.

https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=OUTPUT_003.zip (13 KB | 0 )

Title: Re: Including unwanted object files
Post by Visual Micro on Aug 7th, 2019 at 7:16pm
Are you using libraries as shared projects or just adding #include<> for libraries to your code?

Title: Re: Including unwanted object files
Post by Bob Jones on Aug 7th, 2019 at 7:19pm
I think a little bit of both. I have added explicit references to most libraries (NanoBot->Add->Reference) and each source file explicitly includes the libraries it needs.

Title: Re: Including unwanted object files
Post by Visual Micro on Aug 7th, 2019 at 7:21pm
Maybe tbis is a bug with shared library references. remove the refrence and ensure the libraries are bwlow the  "mydocuments\arduino\libraries". If you move the libraries click then rescan or restart the ide.

With deep search enbabled only the #included libs should be compiled.

Does this work?

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