Connect problem

Hi! I’m trying to connect to Aerospike with C Client LIbrary. I found connect functions in examples, but when i tried to compile code (gcc) i got error:

test.c:(.text+0x1e88): undefined reference to `as_config_init'
test.c:(.text+0x1eba): undefined reference to `aerospike_init'


    #include stdio.h>
    #include stdlib.h>
    #include string.h>
    #include unistd.h>
    #include aerospike/aerospike.h>
    #include aerospike/aerospike_key.h>
    #include aerospike/as_error.h>
    #include aerospike/as_record.h>
    #include aerospike/as_status.h>
    #include aerospike/aerospike.h>
    #include aerospike/aerospike_index.h>
    #include aerospike/aerospike_key.h>
    #include aerospike/aerospike_udf.h>
    #include aerospike/as_bin.h>
    #include aerospike/as_bytes.h>
    #include aerospike/as_error.h>
    #include aerospike/as_config.h>
    #include aerospike/as_key.h>
    #include aerospike/as_operations.h>
    #include aerospike/as_password.h>
    #include aerospike/as_record.h>
    #include aerospike/as_record_iterator.h>
    #include aerospike/as_status.h>
    #include aerospike/as_string.h>
    #include aerospike/as_val.h>
    void main ()
        aerospike* as;
        as_config cfg;
    	as_config_add_host(&cfg, "", 3000);
    	aerospike_init(as, &cfg);
    	as_error err;
        printf("Our first program for Linux.\n");

I have written my app in php and python, it works well but slow, so I decided to try to write it in C lang, but I haven’t any experience in it. Please, just help me to import libs and connect to database. Thanks :slight_smile:

Hi… I am also facing the same issue…Please help if you’d already figured it out…

Thanks in advance!!

Here are my scratch notes from getting a C Client example working, see if it helps!

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:    xenial

Required library:

$cd ~
$sudo apt-get install libssl-dev

Download C Client and install for Ubuntu 16.x:

It was downloaded in my ~/Downloads directory.

$cd Downloads/
$tar xvf aerospike-client-c-4.1.1.ubuntu16.04.x86_64.tgz
$cd aerospike-client-c-4.1.1.ubuntu16.04.x86_64/
$ sudo dpkg -i aerospike-client-c-devel-4.1.1.ubuntu16.04.x86_64.deb
$ cd examples
$ make
$cd basic_examples/
$cd put
$cd target/
$ sudo service aerospike start   (I have a server running in my ubuntu 16 VM)

Output shows I was able to read and write records to the server.

Thank you !.. I will try this one and will let you know if it would work !