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 Visual Studio project include properties. (Read 7230 times)
Dan11
Junior Member
**
Offline


Posts: 11
Joined: Jul 1st, 2013
Visual Studio project include properties.
Jul 1st, 2013 at 9:12pm
Print Post  
Hi Tim,

Sorry to post 3 messages in such quick succession Smiley

Quick suggestion that, in my humble opinion, would make the whole programming experience much more bearable..

Would it be possible to stop Visual Micro re-writing the projects "Additional Include Directories" property. I spent a long time working out the interesting behavior between include files being automatically added to the .vsarduino.h (as well as function decelerations) and the "Additional Include Directories" continually being re-written. Huh

I love the Arduino, but I really dislike how things are done behind the scenes to "make it easier" it seems.

I've been 'fighting' the problems with the include paths with the new 1.5.x arduino release and the new VisualMicro beta and these sort of problems could be easily avoided/worked around if we were actually allowed to make decisions about what Additional Include Directories we want.

Kind regards,
Dan
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Visual Studio project include properties.
Reply #1 - Jul 1st, 2013 at 9:22pm
Print Post  
The next release of vm works with old and new 1.5.3 library formats.

It's a reasonable request to have a setting that provides manual control over the libraries in the build process, Visual Micro and Arduino need to compile the libs to .o files so I guess we would just search the paths for the lib names included in the pde/ino source code.

We have been considering allow a "libraries" folder below the sketch so that a sketch can have it's own libs.

Questions

1) What problem are you having with libraries other than needing to copy the arduino\sam libs up to the ide\libraries level? 

2) You know you can put a library folder below your sketchBook? ie: my documents\arduino\libraries

3) Do you use "Project>Add Arduino Library" to include libs in your sketch? Using the menu item ensures that the correct files are included.

It is supposed to be simple to add libraries and does avoid people needing to set the include paths but I know it can be cumbersome for more experienced users.
  
Back to top
IP Logged
 
Dan11
Junior Member
**
Offline


Posts: 11
Joined: Jul 1st, 2013
Re: Visual Studio project include properties.
Reply #2 - Jul 1st, 2013 at 11:07pm
Print Post  
Hi Tim,

I'm a long time Visual Studio user (since Visual Studio 6) and a few weeks old Arduino user Wink Its quite possible the added complication I'm experiencing is simply down to me not doing things the "Arduino" way.

There may be a simple solution but it seems some of my issues may be caused by personal libraries that themselves include additional libraries. It seems unless I explicitly include the additional dependent libraries in my ino they are never found.

For example, say I have a class 'B', and the header file for B includes class 'A'. I then want to use class 'B' in my ino. So I include B's header file and create an instance of B in setup(). This fails to compile because it cant find the header for file A. If I then explicitly include A in the ino as well, it compiles without issue.

Note: The above is from memory after a frustrating night, I will double check this after work tonight and note down the specifics - I may have just been having one of those moments and doing something ludicrous.

Quote:

1) What problem are you having with libraries other than needing to copy the arduino\sam libs up to the ide\libraries level? 


I finally got my mind around exactly what was happening with the "Additional Include Directory" being re-written and the automatic includes in .vsarduino.h. I then manually copied some libraries into the ide\libraries directory and still had issues with file paths. At this stage I called it a night. I'm afraid I cant give you any specific information. As above Ill give it another whirl tonight and get specifics Smiley

Quote:
2) You know you can put a library folder below your sketchBook? ie: my documents\arduino\libraries


I did see this folder yes Smiley however I am not actually storing my project in my documents\arduino. I have a different file structure that fits in better with my other projects over the years.

Quote:

3) Do you use "Project>Add Arduino Library" to include libs in your sketch? Using the menu item ensures that the correct files are included.


I'm not going to lie, I had seen this menu option but completely forgotten about it until I read these forums further this morning. I haven't been including libs in this manner.

Quote:
We have been considering allow a "libraries" folder below the sketch so that a sketch can have it's own libs.
Sounds like a good addition Smiley

Regards,
Dan
  
Back to top
 
IP Logged
 
Dan11
Junior Member
**
Offline


Posts: 11
Joined: Jul 1st, 2013
Re: Visual Studio project include properties.
Reply #3 - Jul 2nd, 2013 at 11:01am
Print Post  
Hi Tim,

Its late again and I havent had the time I wanted to get the details I needed. I have however made a start at least. Ill update this thread with various examples as I come across them.

I've got a simple example that causes issue below. The Controller object is a simple self contained object - it doesnt have any includes of its own. It resides in a sub-folder "Controller". In my mind this is perfectly acceptable and quite a nice/clean way to structure a large project i.e. Relevant files can live in sub-folders to the main project.

What I think has real potential to confuse in that Visual Studio itself can find the Controller.h without issue. If you right click the #include statement and select "Open document..." it pops up right away, great this should compile then. Not quite, compiling gives a "No such file or directory" error. Undecided

Code
Select All
#include "Controller\Controller.h"

Controller gController;

void setup()
{
}

void loop()
{
    gController.process();
}
 



Keep up the good work. I have to say I am greatful for your time and effort working on this tool - I would go insane trying to use the Arduino IDE Cool
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Visual Studio project include properties.
Reply #4 - Jul 2nd, 2013 at 11:27am
Print Post  
Hi Dan,

These problems are because you do not understand how Arduino works.

You have too much experience of other development systems Smiley

In the Arduino world there is a very rigid set of rules that define where libraries can be located, sub folders are not supported.

A library folder must exists directly below ide\libraries\ or sketchBook\libraries. The library folder must have the same name as a .h that it contains and must not have sub folders other than an optional folder called "utility"

You must abide by these rules otherwise things will not work.

There is never a need to change the C++ project settings, the plugin handles everything and ensure that your project remains compatible with the Arduino IDE.

So your lib structure looks okay but int he sketch you must only include "Controller.h", do not specify the path. Arduino and Visual Micro will automatically discover the path and set everything up for you. Adding the path will break the compile and other stuff.

Use the "Project>Add Arduino Library" menu to add your #includes. This will allow you to see how things work. It will #include "Controller.h"
  
Back to top
IP Logged
 
Dan11
Junior Member
**
Offline


Posts: 11
Joined: Jul 1st, 2013
Re: Visual Studio project include properties.
Reply #5 - Jul 2nd, 2013 at 9:35pm
Print Post  
Hi Tim,

Thanks for your reply - its been quite a confusing learning process, as i thought it comes down to the "Arduino way" of doing things.

What I guess I'm asking is why this is the case? I cant see any technical reason why the plugin needs to abide by these strict Arduino rules. I'm assuming all the file path information is available to the plugin from the IDE?

I have to say that the very reason I wanted to use Visual Studio over the Arudino IDE is to get rid of, or get around the limitation the Arduino IDE places on the user. I imagine this is the case for most people looking for alternatives.

I dont want to sound harsh, its a fantastic tool and well worth the money even just to get into a familiar environment (I bought a license last night Smiley). But, in my opinion, if you could remove these restraints it would take the plugin to a whole new level Shocked
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Visual Studio project include properties.
Reply #6 - Jul 2nd, 2013 at 9:50pm
Print Post  
Hi Dan,

Many people want to maintain compatibility with the arduino ide allowing their open source code to be shared within the community.

New users need little knowledge to use an Arduino library, for example the i2c Wire library requires some knowledge to know which files to include.

Generally project development becomes much slower if one has to mess with library paths. 

Keeping things simple is at the heart of everything Arduino so I think the default behavior it correct and should be understood before the rules are broken. 

The main reason being that it is impossible to support the free product once the rules are broken and difficult for you to obtain support support elsewhere.

Having said all of that you are not the first person to want to do something less-arduino with an arduino so we will add this to the list as an optional feature for a future release.

Thanks for your support. Thanks very much for the support.
« Last Edit: Jul 13th, 2013 at 2:50pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint