# Linker issue for library dependencies

**URL:** <https://discourse.cmake.org/t/linker-issue-for-library-dependencies/13402>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [January 15, 2025, 11:19am UTC](https://discourse.cmake.org/t/linker-issue-for-library-dependencies/13402 "2025-01-15T11:19:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giomo223](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/7993a0/32.png) [@Giomo223](https://discourse.cmake.org/u/Giomo223)\
**Post date:** [January 15, 2025, 11:19am UTC](https://discourse.cmake.org/t/linker-issue-for-library-dependencies/13402/1 "2025-01-15T11:19:23Z")

</div>

Hi everyone,  
I have a little issue with my Cmake configuration.  
This is the structure of my program:  
I have two different cmake files:  
**1** - for exec.out, the executable which links a static library lib.a.  
**2** - for lib.a that contains some references to tensorflow-lite library ‘libtensorflow-lite’

In the lib.a Cmake file I inserted the ‘fetch Content’ to get tflite:

```auto
function(add_local_tflite)
	set(FETCHCONTENT_FULLY_DISCONNECTED OFF)
	set(FETCHCONTENT_QUIET OFF)
	
	include(FetchContent)
	FetchContent_Declare(
	    tflite
	    GIT_REPOSITORY https://github.com/tensorflow/tensorflow.git # Repository TensorFlow
	    GIT_TAG v2.9.1 # Versione 2.9.1 di TensorFlow Lite
		SOURCE_SUBDIR tensorflow/lite # Directory relativa del progetto TensorFlow Lite
	)

	FetchContent_MakeAvailable(tflite)
endfunction(add_local_tflite)

```

and

> target\_link\_libraries(${PROJECT\_NAME} PRIVATE tensorflow-lite)  
> target\_include\_directories(${PROJECT\_NAME} PRIVATE ${tensorflow-lite\_SOURCE\_DIR})

No error for this part.

In the Cmake of the executable I linked the library:

`target_link_libraries(myexec PRIVATE lib)`

I have a problem with the linker because I get some ‘undefined reference’ errors for the object of tflite used in the library:

```auto
undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
undefined reference to `tflite::Interpreter::~Interpreter()'

```

The executable code does not use any references to tflite.

what am I missing?
