1
votes

(Please do not scold me, this is my first question here.)

I'm using Yocto 2.3.1 under Ubuntu. I create image for Raspebrry Pi 3 without any problem. I install Eclipse and yocto-plugin for Eclipse. I create HelloWorld Autotools project and debug it on target hardware - no problems. But, when I try to add some library, besides standart stdlib.h and stdio.h, I get "undefined reference to 'name'" Where I can add a library to Eclipse with Yocto Plugin? I can't find this place!

Source: %)

#include <stdlib.h>
#include <stdio.h>
#include <dbm.h>

int main(void){
 char fn = "someFile";
 dbminit(&fn);
 return 0;
}

Toolchain Root Location: /opt/poky/2.3.1/

Sysroot Location: /opt/poky/2.3.1/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi

(I'm using SDK for my image)

Thanks in advance.

UPD:

Project settings

1
In the eclipse project settings, you didn't find anything about a library path?OneCricketeer
I added project settings screenshot. Unfortunately, the project settings are very poor. I did not find a place where I can specify the used libraries.In some places, on the NXP forums, people talk about making a path to the libraries in the Makefile.am file. But it did not work either.Quarz
I think you need the CDT plugin wiki.eclipse.org/CDT/User/…OneCricketeer
Definitely, I installed exactly Eclipse CDT. And when I creating a project for the host system, I can easily add any library. Build -> Settings -> etc. The problem only with projects for Yocto. And thanks for your help with the formatting.Quarz

1 Answers

0
votes

I have faced this issue before and I solved it by adding needed libraries in Makefile.am file (in the same directory of the source code) to AM_LDFLAGS = ...

here is an example of how the Makefile.am file looks like after adding two OpenCV libraries:

bin_PROGRAMS = nxp
nxp_SOURCES = nxp.cpp

AM_CXXFLAGS = @nxp_CFLAGS@
AM_LDFLAGS = @nxp_LIBS@ -lopencv_core -lopencv_imgproc 

CLEANFILES = *~

save changes, then right click on the project and choose Reconfigure Project before building.