-1

I am playing around with the ci20 and flowcloud. I have downloaded their c library/sdk and have included the header.

The program is simply:

#include <stdio.h>
#include <stdbool.h>
#include <flow/flowcore.h>

int main (int argc, char*argv[])
{
    printf("hello");
    if(FlowCore_Initialise()) printf("init");
    return (0);
}

but on compilation gcc -Wall test.c -o hello I get this error:

/tmp/cch4kocL.o: In function `main':
test.c:(.text+0x40): undefined reference to `FlowCore_Initialise'
collect2: error: ld returned 1 exit status

I am not 100% sure what is going on here.

alk
  • 69,737
  • 10
  • 105
  • 255
uhsl_m
  • 322
  • 3
  • 11

1 Answers1

2

You are getting a linker error. When compiling with gcc, you need to also specifiy the library you want to link to in addition to just using the proper #include 's.

The syntax for compiling with gcc is

$ gcc [options] [source files] [object files] [-Ldir] -llibname [-o outfile]

As you can see you can link the library by adding -l<name> to your command string.

Magisch
  • 7,312
  • 9
  • 36
  • 52