problem in using a library (libpci.a)

This is a discussion on problem in using a library (libpci.a) within the C Programming forums, part of the General Programming Boards category; Hi, I'm having some trouble when I try to use the pci library. Indeed, I don't even succeed to make ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    1

    problem in using a library (libpci.a)

    Hi,

    I'm having some trouble when I try to use the pci library. Indeed, I don't even succeed to make the exemple.c work. As I'm a beginner in programming let me tell you what I do (and maybe you'll find easily what is wrong).

    * I download the pciutils-2.1.11
    * I type "make" (it seems to work but if you want to take a look of what it does I wrote it at the end of this mail)
    * I type "make install" (I think it's not useful for what I want to do but anyway...)
    * then I go into the /lib directory and type :
    " g++ -o example example.c ./libpci.a
    and I get :

    /tmp/ccjwSteX.o(.text+0x11): dans la fonction « main »:
    : undefined reference to `pci_alloc()'
    /tmp/ccjwSteX.o(.text+0x1f): dans la fonction « main »:
    : undefined reference to `pci_init(pci_access*)'
    /tmp/ccjwSteX.o(.text+0x2d): dans la fonction « main »:
    : undefined reference to `pci_scan_bus(pci_access*)'
    /tmp/ccjwSteX.o(.text+0x4e): dans la fonction « main »:
    : undefined reference to `pci_fill_info(pci_dev*, int)'
    /tmp/ccjwSteX.o(.text+0x5e): dans la fonction « main »:
    : undefined reference to `pci_read_word(pci_dev*, int)'
    /tmp/ccjwSteX.o(.text+0xc3): dans la fonction « main »:
    : undefined reference to `pci_cleanup(pci_access*)'
    collect2: ld a retourné 1 code d'état d'exécution

    So if you have some time to answer me, it would be great.
    Thanks in advance.

    jean-yves

    ((would it be possible to write back directly at : jean_yves_m@hotmail.com ? thanks))



    when I type "make" :

    cd lib && ./configure /usr/local/share 2.1.11
    Configuring libpci for your system... Linux/i386 2.4.22-1.2149.nptl
    Looking for access methods... proc i386-ports dump
    make -C lib all
    make[1]: Entre dans le répertoire `/Download/pciutils-2.1.11/lib'
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o access.o access.c
    access.c: Dans la fonction « pci_null_debug »:
    access.c:119: attention : unused parameter `msg'
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o generic.o generic.c
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o dump.o dump.c
    dump.c: Dans la fonction « dump_cleanup »:
    dump.c:73: attention : unused parameter `a'
    dump.c: Dans la fonction « dump_scan »:
    dump.c:78: attention : unused parameter `a'
    dump.c: Dans la fonction « dump_write »:
    dump.c:100: attention : unused parameter `buf'
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o names.o names.c
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o filter.o filter.c
    filter.c: Dans la fonction « pci_filter_init »:
    filter.c:17: attention : unused parameter `a'
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o proc.o proc.c
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o i386-ports.o i386-ports.c
    i386-ports.c: Dans la fonction « conf12_cleanup »:
    i386-ports.c:39: attention : unused parameter `a'
    rm -f libpci.a
    ar rcs libpci.a access.o generic.o dump.o names.o filter.o proc.o i386-ports.o
    ranlib libpci.a
    make[1]: Quitte le répertoire `/Download/pciutils-2.1.11/lib'
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o lspci.o lspci.c
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o common.o common.c
    cc lspci.o common.o lib/libpci.a -o lspci
    cc -O2 -fomit-frame-pointer -Wall -W -Wno-parentheses -Wstrict-prototypes -c -o setpci.o setpci.c
    cc setpci.o common.o lib/libpci.a -o setpci
    M=`echo 2003-01-04 | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <lspci.man >lspci.8 "s/@TODAY@/$M/;s/@VERSION@/pciutils-2.1.11/;s#@SHAREDIR@#/usr/local/share#"
    M=`echo 2003-01-04 | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <setpci.man >setpci.8 "s/@TODAY@/$M/;s/@VERSION@/pciutils-2.1.11/;s#@SHAREDIR@#/usr/local/share#"
    sed <update-pciids.sh >update-pciids "s@^DEST=.*@DEST=/usr/local/share/pci.ids@"M=`echo 2003-01-04 | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <update-pciids.man >update-pciids.8 "s/@TODAY@/$M/;s/@VERSION@/pciutils-2.1.11/;s#@SHAREDIR@#/usr/local/share#"


    when I type "make install" :

    make -C lib all
    make[1]: Entre dans le répertoire `/Download/pciutils-2.1.11/lib'
    make[1]: Rien à faire pour `all'.
    make[1]: Quitte le répertoire `/Download/pciutils-2.1.11/lib'
    install -d -m 755 /usr/local/sbin /usr/local/share /usr/local/share/man/man8
    install -c -m 755 -s lspci setpci /usr/local/sbin
    install -c -m 755 update-pciids /usr/local/sbin
    install -c -m 644 pci.ids /usr/local/share
    install -c -m 644 lspci.8 setpci.8 update-pciids.8 /usr/local/share/man/man8

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,812
    what compiler are you using? opps never mind try adding -libpci
    Woop?

  3. #3
    ---
    Join Date
    May 2004
    Posts
    1,379
    >((would it be possible to write back directly at : jean_yves_m@hotmail.com ? thanks))

    i dont think he is coming back
    Last edited by sand_man; 06-17-2004 at 09:40 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. undefined Reference when linking a library
    By steve1_rm in forum C Programming
    Replies: 7
    Last Post: 03-12-2008, 06:34 PM
  2. Templates from DLL or static library problem
    By mikahell in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2008, 01:49 AM
  3. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  4. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 06:20 AM
  5. Problem With WinPcap library
    By DrMario in forum C Programming
    Replies: 0
    Last Post: 03-26-2005, 11:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21