[lxc-devel] Working with C api library for LXC

Serge Hallyn serge.hallyn at ubuntu.com
Tue Jun 17 13:15:14 UTC 2014


Quoting vinish ramachandran (vinishr at gmail.com):
> Hi Everyone,
> 
> I have a fedora-20 machine on which i have installed lxc version-1.0.3 by
> enabling yum to install packages from Rawhide repository using the
> following steps
> 
> # yum install fedora-release-rawhide yum-utils
> # yum-config-manager --disable fedora updates updates-testing
> # yum-config-manager --enable rawhide
> # yum update yum
> # yum --releasever=rawhide distro-sync --nogpgcheck
> 
> My uname -a give the following output:3.14.5-200.fc20.x86_64 #1 SMP Mon Jun
> 2 14:26:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> 
> I can see "/usr/lib64/liblxc.so.1.0.3" in my system.
> 
> 
> Now i want to create and do basic operation on lxc using the pais provided.
> I have a sample code that creates a container does that but it does not
> compile , instead it throws the following error.:
> lxc_test.c:(.text+0x1a): undefined reference to `lxc_container_new'
> lxc_test.c:(.text+0x254): undefined reference to `lxc_container_put'.
> 
> What am i doing wrong??

How exactly are you compiling.  Make sure to add a -llxc to the
command.

> I am a newbee , so please dont mind my ignorance :)
> 
> Thanks
> Vinish

> #include <stdio.h>
> #include <lxc/lxccontainer.h>
> 
> int main()
> {
>     struct lxc_container *c;
>     int ret = 1;
>     /* Setup container struct */
>     c = lxc_container_new("apicontainer", NULL);
>     if (!c)
>       {
>         lxc_container_put(c);
>       }
>   while (1);
>   return 0;
> }
> ~   
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel



More information about the lxc-devel mailing list