Hello
I am getting following errors.
#include <pololu/3pi.h>
int main()
{
print("Hello!");
play("L16 ceg>c");
while(1)
{
red_led(0);
green_led(1);
delay_ms(100);
red_led(1);
green_led(0);
delay_ms(100);
}
return 0;
}
Build started 10.4.2011 at 14:42:50
avr-gcc -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT TestAtmel.o -MF dep/TestAtmel.o.d -c ../TestAtmel.c
avr-gcc -mmcu=atmega128 -Wl,-Map=TestAtmel.map TestAtmel.o -o TestAtmel.elf
TestAtmel.o: In function `main':
D:\Jagdish\DVD-21\default/../TestAtmel.c:5: undefined reference to `print'
D:\Jagdish\DVD-21\default/../TestAtmel.c:7: undefined reference to `play'
D:\Jagdish\DVD-21\default/../TestAtmel.c:11: undefined reference to `red_led'
D:\Jagdish\DVD-21\default/../TestAtmel.c:12: undefined reference to `green_led'
D:\Jagdish\DVD-21\default/../TestAtmel.c:14: undefined reference to `delay_ms'
D:\Jagdish\DVD-21\default/../TestAtmel.c:16: undefined reference to `red_led'
D:\Jagdish\DVD-21\default/../TestAtmel.c:17: undefined reference to `green_led'
D:\Jagdish\DVD-21\default/../TestAtmel.c:19: undefined reference to `delay_ms'
make: *** [TestAtmel.elf] Error 1
Build failed with 8 errors and 0 warnings...
Could you please explain to me why I am getting these errors.
Regards
Jagdish
You need to add -lpololu_atmega328p.a (if you have a 3pi with a ATMega328p) to the arguments during the linking step to tell the linker to use the Pololu AVR Library. Please see the “Using the Pololu AVR Library for your own Projects” section of the Pololu AVR C/C++ Library User’s Guide
or just try to compile one of the many example projects that come with the library, because those projects are already configured correctly.
–David
Hello
Thanks for the info.
Its gone down to 4 errors. I think it is not finding those functions. Eventhough I have leds.h file in external dependencies files. Some thing is still missing in configuration.
Could you please advice me what else is missing for set up. I tried with both header files. But result is same.
#include <pololu/orangutan.h> (original)
//#include <pololu/3pi.h> ( I tried with this header file)
Regards
Jagdish
Build started 11.4.2011 at 15:09:44
avr-gcc -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT TestAvr328.o -MF dep/TestAvr328.o.d -c ../TestAvr328.c
avr-gcc -mmcu=atmega128 -WI,-gc-sections -Wl,-Map=TestAvr328.map TestAvr328.o -lpololu_atmega328p -o TestAvr328.elf
TestAvr328.o: In function `main':
D:\Jagdish\DVD-21\TestAvr328\default/../TestAvr328.c:15: undefined reference to `red_led'
D:\Jagdish\DVD-21\TestAvr328\default/../TestAvr328.c:16: undefined reference to `green_led'
D:\Jagdish\DVD-21\TestAvr328\default/../TestAvr328.c:20: undefined reference to `red_led'
D:\Jagdish\DVD-21\TestAvr328\default/../TestAvr328.c:21: undefined reference to `green_led'
make: *** [TestAvr328.elf] Error 1
Build failed with 4 errors and 0 warnings...
The functions red_led and green_led are defined as static inline functions in leds.h. They should have been found at compile time, not link time. Maybe you are trying to use an leds.h from an older version of the library but you are linking with a newer version of the library .a file.
Could you make sure that you have the latest version of the AVR library by downloading it from here:
pololu.com/docs/0J20/2
and installing it using these instructions:
pololu.com/docs/0J20/3
Then please go to examples\atmega328p\simple-test and open simple-test.aps and see if you can build that project.
(Also, in your other project, you are mistakenly using -mmcu=atmega128)
–David
Hello
It is OK. Program compiles without any error with and without using .aps file.
Thanks for the support. Now I will try with 3Pi Robot.
Jagdish