🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.linux.ggg
Article #1

gcc-newbie question...

#1
From: Geir
Date: Mon, 31 Jul 2000 00:00
44 lines
1950 bytes
I have just started to try out a little C-programming under Linux and I
am playing around with some small programs just to "try things out". I
wrote the following program which simply is supposed to displays a
message if there is a PCI-bios presenet in the machine;


#include <linux/pci.h>

int main(){
    if (pcibios_present()) printf("PCI-bios found...");
}


int pcibios_present(void) is defined in pci.h...
I then try to compile the program with:

gcc -D__KERNEL__ testpci.c

testpci.c is of course the name of the program and __KERNEL__ needs to
be defined when including "pci.h" to get everything included.
But when I try compiling I get an error-message from ld (the linker),
saying:

undefined reference to 'pcibios_present'

I suppose this means the linker cant find the "pci.o"-object file or
something, and therefore is unable to link in 'pcibios_present()'.

How should I compile this program to make it work?
What am I doing wrong?

All the libraries should be installed in their "standard" places as I am

just using a freshly installed Linux distribution from SuSE.

Hope somebody can help me out...


Geir.




Technical Details
Message-ID: <3985A101.DF0D3D03@online.no>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-linux.dev.gcc.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <3985A101.DF0D3D03@online.no>
Subject: gcc-newbie question...
Date: Mon, 31 Jul 2000 00:00:00 +0000
From: Geir <arholler@online.no>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-linux.dev.gcc.mbox.zip!not-for-mail
X-Deja-AN: 652823414
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news-abuse@online.no
X-Trace: news1.online.no 965058738 130.67.75.99 (Mon, 31 Jul 2000 17:52:18 MET DST)
Organization: Telenor Online Public Access
MIME-Version: 1.0
NNTP-Posting-Date: Mon, 31 Jul 2000 17:52:18 MET DST
Newsgroups: gnu.gcc.help,fa.linux.ggg,linux.dev.gcc