Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:37:04+00:00 2026-06-06T04:37:04+00:00

I am trying to make a small application for my arm target. I have

  • 0

I am trying to make a small application for my arm target. I have already set up the toolchain in eclipse under linux. Now i am trying to build libraries.

here is my library header file led.h:

#ifndef LED_H_
#define LED_H_

extern char ledon(char lednum);
extern char ledoff(char lednum);

#endif /* LED_H_ */

and my c file led.c :

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <led.h>
int fd = 0;

char ledon(char lednum)
{
    switch(lednum)
    {
    case 0 :fd = open("/sys/class/leds/beaglebone::usr0/brightness", O_WRONLY);
               break;
    case 1 :fd = open("/sys/class/leds/beaglebone::usr1/brightness", O_WRONLY);
                break;
    case 2 :fd = open("/sys/class/leds/beaglebone::usr2/brightness", O_WRONLY);
                break;
    case 3 :fd = open("/sys/class/leds/beaglebone::usr3/brightness", O_WRONLY);
                break;

    }
    if (fd>0)
    {
        write(fd,"1",sizeof(char));
        close(fd);
        return 1;
     }
    else
    {
        printf("Message form library function\n Error reading the LED %d",lednum);
        return 0;
    }


}

char ledoff(char lednum)
{
    switch(lednum)
    {
    case 0 :fd = open("/sys/class/leds/beaglebone::usr0/brightness", O_WRONLY);
               break;
    case 1 :fd = open("/sys/class/leds/beaglebone::usr1/brightness", O_WRONLY);
                break;
    case 2 :fd = open("/sys/class/leds/beaglebone::usr2/brightness", O_WRONLY);
                break;
    case 3 :fd = open("/sys/class/leds/beaglebone::usr3/brightness", O_WRONLY);
                break;

    }
    if (fd>0)
    {
        write(fd,"0",sizeof(char));
        close(fd);
        return 1;
     }
    else
    {
        printf("Message form library function\n Error reading the LED %d",lednum);
        return 0;
    }


}

compiling the above i get led.h and libled.so.

now i create a test c file ledtest.c in a different project.

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <led.h>

int main(void) {

    while(1)
    {
        ledon(2);
        sleep(1);
        ledoff(2);
        sleep(1);
    }

    return EXIT_SUCCESS;
}

I made two folders “include” which contains led.h and “lib” which contains libled.so.

I have configured as follows:
Include paths
library paths

Now when i compile ledtest.c i get the following error

make all 
Building target: ledtest
Invoking: GCC C Linker
arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -L/home/sanatan/Coustom/lib -o      
   "ledtest"  ./src/ledtest.o   
./src/ledtest.o: In function `main':
ledtest.c:(.text.startup+0x4): undefined reference to `ledon'
ledtest.c:(.text.startup+0x10): undefined reference to `ledoff'
collect2: ld returned 1 exit status
make: *** [ledtest] Error 1

But if i add the libled.so in the libraries :

i get the below error:

**** Build of configuration Release for project ledtest ****

make all 
Building file: ../src/ledtest.c
Invoking: GCC C Compiler
arm-linux-gnueabi-gcc -I/home/sanatan/Coustom/include -I/usr/arm-linux-
    gnueabi/include -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/ledtest.d" -
    MT"src/ledtest.d" -o "src/ledtest.o" "../src/ledtest.c"
Finished building: ../src/ledtest.c

Building target: ledtest
Invoking: GCC C Linker
arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -L/home/sanatan/Coustom/lib -o 
    "ledtest"  ./src/ledtest.o   -l/home/sanatan/Coustom/lib/libled.so
/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../../arm-linux-gnueabi/bin/ld: cannot 
    find -l/home/sanatan/Coustom/lib/libled.so
collect2: ld returned 1 exit status
make: *** [ledtest] Error 1

**** Build Finished ****

But i am sure the file is there :

root@ubuntu:/home/sanatan/Coustom/lib# ls
led.o  libled.so

Can someone please help me out here, i don’t know what to do. Believe me i did my homework.. 🙂

thanks in advance.

Sanatan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:37:06+00:00Added an answer on June 6, 2026 at 4:37 am

    Whenever you want to link to a library you need to include the option

        -lxyz
    

    to link to library with name libxyz and possibly include the path to it using a -L option. As the comment of Fred says, it would appear you may need to add the -lled option.

    For details on how to add a library to a project in Eclipse, see the answer to this question

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I finished my small application and I am trying to make sure I have
I am trying to make a small ASP.NET application where I have a GridView
I'm currently trying to make a small application that performs different duties. Right now
I'm trying to build a small class-like container that will make it a little
I am trying to make a small facebook application with php & facebook PHP
I'm trying to make a small application that shows a notification for each 10
I'm currently trying to make a small testing application for various programming tasks. It
i am new to Blackberry application development. now i am trying to make new
I am trying to make a small java application, and I need the corners
I am trying to make a small pizza order form, but I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.