I am trying to compile the main.c file in Linux environment there are three header files included in main.c
#include <stdio.h>
#include <assert.h>
#include "ftd2xx.h"
getting the errors…
/usr/bin/ld: /tmp/ccKGcfmV.o: in function `main':
main.c:(.text+0x21c): undefined reference to `FT_Open'
/usr/bin/ld: main.c:(.text+0x2a4): undefined reference to `FT_ResetDevice'
/usr/bin/ld: main.c:(.text+0x2dc): undefined reference to `FT_SetBaudRate'
/usr/bin/ld: main.c:(.text+0x321): undefined reference to `FT_SetDataCharacteristics'
/usr/bin/ld: main.c:(.text+0x354): undefined reference to `FT_SetDtr'
/usr/bin/ld: main.c:(.text+0x396): undefined reference to `FT_SetFlowControl'
/usr/bin/ld: main.c:(.text+0x3c9): undefined reference to `FT_SetRts'
/usr/bin/ld: main.c:(.text+0x406): undefined reference to `FT_SetTimeouts'
/usr/bin/ld: main.c:(.text+0x451): undefined reference to `FT_Write'
/usr/bin/ld: main.c:(.text+0x4dd): undefined reference to `FT_Close'
collect2: error: ld returned 1 exit status
15
Your command to built the application lacks the option to link the library.
Try this:
gcc main.c -lftd2xx
Please be aware that the resulting binary has the default name of a.out
, which might not be what you want.
I suggest to learn a bit more about general usage of compilers, linkers, and GCC as your actual compiler.