VS Arduino
Visual Micro >> Visual Studio 2017, 2019, 2022 >> Custom include path
https://www.visualmicro.com/forums/YaBB.pl?num=1492055657

Message started by Paul Martinsen on Apr 13th, 2017 at 3:54am

Title: Custom include path
Post by Paul Martinsen on Apr 13th, 2017 at 3:54am
Hello,

Is it possible to add additional directories to the complier's search path? Either through -I or -iquote command line variables?

I'm trying to make this work:
Solution
+ Shared Project
++ ComplierDefinitions
+++ Definitions.h
+ Arduino Project
+ CLR Project
++ ComplierDefinitions
+++ Definitions.h


Various files in the Shared Project and Arduino Project do
#include "Definitions.h"

For the Arduino Project I want this to reference the one in Shared Project/Compiler Definitions; for the CLR Project I want it to reference the one in CLR Project/CompilerDefinitions

So I hoped I could add $(ProjectDir)CompilerDefintions to the include path property for the Arduino Project and CLR Project projects.

I tried adding $(ProjectDir)CompilerDefinitions to my Arduino Project but that doesn't seem to do it (I see the avr-g++ call in the output window when building Arduino Project but it doesn't include my extra folder).

Kind regards
Paul.

Title: Re: Custom include path
Post by Paul Martinsen on Apr 13th, 2017 at 4:44am
I should have looked a little longer. For anyone else who has this problem...

I found you can access Visual Micro project properties in the Properties window (view -> properties window) rather than the Project Properties dialog.

There is a "Extra cpp flags" property, which get appended the the gcc call.

Visual Micro doesn't use MS Build properties but defines a bunch of its own including build.path. So I solved my problem by adding:
-I"{build.path}" -I"{build.path}\CompilerDefinitions"
to "Extra cpp flags".




Title: Re: Custom include path
Post by Visual Micro on Apr 13th, 2017 at 11:12am
Thanks for the update. Yes the extra flags are a simple way to add paths.

Using Visual Studio shared projects can also be useful and make it easier to edit and see the code in the solution explorer.


VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.