Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Dec 1999 21:41:56 +0100 (CET)
From:      Ronald 'Ko' Klop <ronald@node11a94.a2000.nl>
To:        freebsd-questions@freebsd.org
Subject:   Q: using kvm gives a compile error
Message-ID:  <Pine.BSF.4.05.9912222136540.1813-100000@dlanor.evertsen.nl>

next in thread | raw e-mail | index | archive | help
Hello,

I'm trying to write a program using kvm.
But even the simplest program failes to compile.

Here is my program iftest.cc:
#include <fcntl.h>
#include <kvm.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc,char **argv) {
        char *nlistf=NULL,*memf=NULL;
        kvm_t *kvmd;

        kvmd = kvm_open(nlistf,memf,NULL,O_RDONLY,"kvm: ");
        if (kvmd==NULL) {
                printf("error opening kvm\n");
                exit(0);
        }
        kvm_close(kvmd);
        return 0;
}


Compiling gives the following output:
g++ iftest.cc 
/var/tmp/ccOV18281.o: In function `main':
/var/tmp/ccOV18281.o(.text+0x26): undefined reference to `kvm_open'
/var/tmp/ccOV18281.o(.text+0x55): undefined reference to `kvm_close'

I have read the man pages searched the mail archive, but didn't find
anything. I also looked at the implementation of top and netstat.
But couldn't find a clue about what I am forgetting.

Does somebody know how to do this?

Greetings,

Ronald.

PS: I'm trying to do this to get the number of send/received bytes across
the ethernet from the kernel.

-- 
Ronald Klop
http://node11a94.a2000.nl/~ronald/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9912222136540.1813-100000>