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 Libraries Search Paths (Read 6454 times)
bassmoss
Newbies
*
Offline


Posts: 3
Location: Canberra, Australia
Joined: Dec 13th, 2011
Libraries Search Paths
Dec 13th, 2011 at 8:57pm
Print Post  
Hi there,
 
I have been able to get Visual Studio working with the Arduinos using the Visual Micro add-in. It works really well for simple programs. I have tried to compile more complicated stuff, including simple ardupilot code. Unfortuately, I am having trouble handling external library directories in the code. The include directives cannot find the directories where these .h files exist. 
 
For example :
 
#include <FastSerial.h>

#include <AP_Common.h>

#include <AP_GPS.h>

#include <Servo.h> 

#define USB_BAUD 57600

#define GPS_BAUD 9600

#define XBEE_BAUD 57600

 

This comes up the errors saying it cannot open the files as it cannot find the directories. I cannot find in Visual Studio where you can put search paths for the library directories. I don't want to hard code them in to the soruse code as they are in all different directories.

 

I have hard coded some of the libraries, and that does fixed the problem. But it is not a very good solution as all of the .h files are in different subdirectories. 

 

#include <C:\Dickson College\UAV Challenge\ardupilot\APM - 2.0 - beta\APM 2.0\libraries\FastSerial\FastSerial.h>

#include <C:\Dickson College\UAV Challenge\ardupilot\APM - 2.0 - beta\APM 2.0\libraries\AP_Common\AP_Common.h>

#include <C:\Dickson College\UAV Challenge\ardupilot\APM - 2.0 - beta\APM 2.0\libraries\AP_GPS\AP_GPS.h>

#include <C:\Dickson College\UAV Challenge\arduino23\arduino-0023\libraries\Servo\Servo.h> 

#define USB_BAUD 57600

#define GPS_BAUD 9600

#define XBEE_BAUD 57600

 

 

Does anyone know where I can put search paths in Visual Studio so the compiler can find the .h files?

 

Any suggestions are appreciated. 

 

Thanks very much,

 

Andrew

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Libraries Search Paths
Reply #1 - Dec 13th, 2011 at 9:34pm
Print Post  
Hi,

With arduino you should not hard code the paths. The way both arduino and vs work is that the libraries are expected to be in one of two places:-

1)arduino\libraries
2)documents\arduino\libraries

The first "arduino" path is wherever you have installed arduino.

The second is whatever you have set your arduino sketch book folder to. The default is shown above. You seem to expect yours to be "C:\Dickson College\UAV Challenge\ardupilot\APM - 2.0 - beta\APM 2.0\Libraries".  (by the way it isn't generally best practise to include dots in folder names)

If you haven't set your arduino sketch folder then close visual studio and open the arduino ide. Click file>preferences as documented on diyd wiki. 

NB: Don't forget to remove the path qualifiers you added. Notice that servo.h is a core library installed with arduino, you won't have had a compile error for that one Smiley

Please confirm if you have done this and that the apm code does compile in your arduino ide.

Thanks
« Last Edit: Dec 13th, 2011 at 9:38pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint