F
F
friendly_fire2015-01-16 23:27:17
Eclipse
friendly_fire, 2015-01-16 23:27:17

How to create and include a library in Eclipse?

Good afternoon! I'm torturing atmega8. Installed AVR Eclipse Plugin. Tried two ways:
1. Created an AVR Cross Target Static Library (File - New - C Project) project called LIB.
I created LCD_lib.h and LCD_lib.c in it.
I'm trying to connect a "library" to another project:
Project - Properties - C / C ++ General - Path and Symbols - Source Location - link folder - Link to folder in the file system, through Browse I found the LIB folder (in Workspace), in main.c registered #include "LCD_lib.h". Outcome - error: No such file or directory
2015_01_16_23_01_49_800.jpgi.gif
2. In the Workspace, I created the #lib folder and copied the LCD_lib.h and LCD_lib.c files into it. I connect to the project: Project - Properties - C / C ++ General - Path and Symbols - includes - add, through Browse I found the #lib folder (in the Workspace), in main.c I wrote #include "LCD_lib.h". In the includes folder of the project, the path to the folder somehow appeared (not immediately), and there is no error in main.c. But now the error is in the makefile. Help me to do it right, I have already killed two evenings wrong ( updt1: I read that the library is a file with the extension .a (path 1). In my case, the file was libLCD_lib.a. I connect it to the project: Project - Properties - C / C ++ General - Path and Symbols - Librares I get an error:
Skrynshot_2015_01_16_23_17_14_800.jpgi.gif

avr-gcc -Wl,-Map,DS1307+LCD_4bit.map -mmcu=atmega8 -o "DS1307+LCD_4bit.elf"  ./main.o   -l"/Users/chud0/Documents/workspace/LIB/Release/libLCD_lib.a"
/usr/local/CrossPack-AVR-20131216/lib/gcc/avr/4.8.1/../../../../avr/bin/ld: cannot find -l/Users/chud0/Documents/workspace/LIB/Release/libLCD_lib.a

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
friendly_fire, 2015-01-17
@friendly_fire

I'll answer myself) You need to in Project - Properties - C / C ++ Build - Tool Settings - AVR C Linker - Libraries in Libraries Path enter the path to the folder with the file, in Libraries - the file name without the lib prefix and the .a extension, i.e. I have a file with the library libLCD_lib.a, so I enter only LCD_lib.
Skrynshot_2015_01_17_21_44_28_800.jpgi.gif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question