VS Arduino | |
Visual Micro >> Installation & Troubleshooting >> Another External Library Compile issue
https://www.visualmicro.com/forums/YaBB.pl?num=1322936046 Message started by BrianB on Dec 3rd, 2011 at 6:14pm |
Title: Another External Library Compile issue Post by BrianB on Dec 3rd, 2011 at 6:14pm
So what we have here is a simple Servo test app referencing the external servo library...
#include <C:\Program Files\arduino-0023\libraries\Servo\Servo.h> Servo myServo; int servoPin = 9; void setup() { pinMode(servoPin,OUTPUT); myServo.attach(servoPin); } void loop() { Serial.println("GO"); for (int i=0; i<=180; i=i+5) { myServo.write(i); Serial.println(i); delay(100); } } When compiling I get the following.... Compiling 'ServoTest' for 'Arduino Uno' ServoTest.cpp.o : In function `__static_initialization_and_destruction_0' ServoTest.cpp : Servo()' ServoTest.cpp.o : In function `loop' ServoTest.cpp : write(int)' ServoTest.cpp.o : In function `setup' ServoTest.cpp : attach(int)' : No such file : No such file Couldn't determine program size: C:\Program Files\arduino-0023\hardware\tools\avr\bin\avr-size: 'C:\Users\bbender\AppData\Local\VMicro\Arduino\Builds\ServoTest\uno\ServoTest.hex': No such file (0.6484375 secs) Uploading to I/O board using 'COM6' avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ System wide configuration file is "C:\Program Files\arduino-0023\hardware\tools\avr\etc\avrdude.conf" Using Port : \\.\COM6 Using Programmer : stk500v1 Overriding Baud Rate : 115200 avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Recv: avrdude: Recv: AVR Part : ATMEGA328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 5 4 0 no 1024 4 0 3600 3600 0xff 0xff Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 ... Out of space to paste but "avrdude done. Thank you." |
Title: Re: Another External Library Compile issue Post by Visual Micro on Dec 3rd, 2011 at 7:06pm
i notice you have included the servo lib manually. that can lead to mistakes. the best way to include libs is to use the "Add Arduino Library" option on the project menu.
i doubt the same souce compile in arduino? the way the arduino compiler works is that it works out the lib paths from the includes. this is why when arduino (or vs) includes libs it does not add the full path. in visual studio you simply add arduino library then click save to udpate the intellisense or just hit the compile button. i just used your code but i removed the #include and let visual studio add it for me. it just added #include <Servo.h> and it compiled okay it is important to use the menu item to add libs. because... if there is more than one .h file in the lib folder you will get an #include for each file. otherwise things might break :) |
Title: Re: Another External Library Compile issue Post by BrianB on Dec 4th, 2011 at 2:56am
Thank you very much. that worked.
Newb to Arduino... Vet to C# I'll get there |
Title: Re: Another External Library Compile issue Post by BrianB on Dec 4th, 2011 at 3:44am
Sorry, but how do you add custom libraries that are not in Arduino by default?
Do you have to manually copy them to the Arduino install path library folder? Because I did that with the Ultrasonic.h library from here... http://iteadstudio.com/application-note/arduino-library-for-ultrasonic-ranging-module-hc-sr04/ and added this code along with placing library under my C:\Program Files\arduino-1.0\libraries VS along with intellisense recognized the library under the drop down menu after a reboot of the IDE and I added library the way you specified along with the following code... #include <Ultrasonic.h> Ultrasonic ultrasonic( 12, 13 ); void setup() { Serial.begin( 9600 ); } void loop() { Serial.print(ultrasonic.Ranging(CM)); Serial.println("cm"); delay(1000); } Here is the compile error... Compiling 'UltrasonicTest' for 'Arduino Uno' UltrasonicTest.pde : In file included from Ultrasonic.h : No such file or directory Ultrasonic.cpp : No such file or directory Ultrasonic.cpp : Ultrasonic(int, int)' Ultrasonic.cpp : 'OUTPUT' was not declared in this scope Ultrasonic.cpp : 'pinMode' was not declared in this scope Ultrasonic.cpp : 'INPUT' was not declared in this scope Ultrasonic.cpp : Timing()' Ultrasonic.cpp : 'LOW' was not declared in this scope Ultrasonic.cpp : 'digitalWrite' was not declared in this scope Ultrasonic.cpp : 'delayMicroseconds' was not declared in this scope Ultrasonic.cpp : 'HIGH' was not declared in this scope Ultrasonic.cpp : 'pulseIn' was not declared in this scope Error compiling Thanks for your help. |
Title: Re: Another External Library Compile issue Post by BrianB on Dec 4th, 2011 at 3:55am
Further searching I found that since I added Arduino 1.0 I needed to modify the Ultrasonic library from...
#include "WProgram.h" to.. #include "Arduino.h" Most compile errors went away but these remain... Compiling 'UltrasonicTest' for 'Arduino Uno' Ultrasonic.pde : In file included from Ultrasonic.h : No such file or directory Ultrasonic.cpp : In file included from Ultrasonic.h : No such file or directory Error compiling |
Title: Re: Another External Library Compile issue Post by BrianB on Dec 4th, 2011 at 4:16am
Disregard....
Forgot to change reference in Ultrasonic.h as well as .cpp Genius! All is well. Baby steps. |
Title: Re: Another External Library Compile issue Post by Visual Micro on Dec 4th, 2011 at 6:31pm
yep, seems kind of dumb to have changed wprogram.h to arduino.h. so much old code uses it. just as dumb as changing the arduino.cc forum address :) it kills backward compatibility.
i'm pleased you got it working. you can also create a "libraries" folder under your sketch book folder. for example "document\arduino\libraries". putting libs under the sketchbook causes them to show on the "Add Arduino Library>User" menu instead of "Add Arduino Library>Core" |
Title: Re: Another External Library Compile issue Post by BrianB on Dec 5th, 2011 at 5:04am
Nice! Very helpful. Thanks!
|
VS Arduino » Powered by YaBB 2.6.12! YaBB Forum Software © 2000-2024. All Rights Reserved. |