# Unable to test Godot GDExtension -- undefined reference to symbol

**URL:** https://discourse.cmake.org/t/unable-to-test-godot-gdextension-undefined-reference-to-symbol/10538
**Category:** Usage
**Tags:** os:linux, os:windows
**Created:** [March 30, 2024, 11:04am UTC](https://discourse.cmake.org/t/unable-to-test-godot-gdextension-undefined-reference-to-symbol/10538 "2024-03-30T11:04:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cyberpuffin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cyberpuffin/32/4455_2.png) [@cyberpuffin](https://discourse.cmake.org/u/cyberpuffin)
#### Post date: [March 30, 2024, 11:04am UTC](https://discourse.cmake.org/t/unable-to-test-godot-gdextension-undefined-reference-to-symbol/10538/1 "2024-03-30T11:04:09Z")

</div>

Hello.

I am trying to add doctest unit testing to my Godot GDExtension project with CMake. I am pretty sure my CMakeLists.txt is accurate, but I’m a CMake newb.

A minimally viable project is available at [GitHub - cyberpuffin-digital/gdexample at doctest](https://github.com/cyberpuffin-digital/gdexample/tree/doctest). The tests reside in a test folder and the build directory of .cmake. The project’s Makefile contains targets for building the various components.

Executing the `tests` target completes [gdexample/test/CMakeLists.txt at doctest · cyberpuffin-digital/gdexample · GitHub](https://github.com/cyberpuffin-digital/gdexample/blob/doctest/test/CMakeLists.txt) up to the point of linking the test file before spitting out a bunch of text. Towards the end, I see several errors like:

```auto
/usr/bin/ld: test_gdexample.cpp:(.text+0x15eb3): undefined reference to `godot::GDExample::is_prime(int)'

```

I’ve linked to the built object and its header files to make the publicly scoped function visible.

This was also done in Linux and I’m running tests on Windows to ensure the build process is working.

Any help or guidance would be appreciated.

---

<div class="post-metadata">

### Author: ![cyberpuffin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cyberpuffin/32/4455_2.png) [@cyberpuffin](https://discourse.cmake.org/u/cyberpuffin)
#### Post date: [March 30, 2024, 11:04am UTC](https://discourse.cmake.org/t/unable-to-test-godot-gdextension-undefined-reference-to-symbol/10538/2 "2024-03-30T11:04:50Z")

</div>

FYI: This discussion is also present in the Godot discourse: [Adding doctest to GDExtension for unit testing - Programming - Godot Forum](https://forum.godotengine.org/t/adding-doctest-to-gdextension-for-unit-testing/53380).
