# Duplicate definitions with 3rd party glib

**URL:** <https://forums.unrealengine.com/t/duplicate-definitions-with-3rd-party-glib/472215>\
**Category:** C++\
**Tags:** third-party-librarie, unreal-engine, compile-error, build-failed, CPP, question\
**Created:** [October 1, 2020, 12:07am UTC](https://forums.unrealengine.com/t/duplicate-definitions-with-3rd-party-glib/472215 "2020-10-01T00:07:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaffeeeKind](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KaffeeeKind](https://forums.unrealengine.com/u/KaffeeeKind)\
**Post date:** [October 1, 2020, 12:07am UTC](https://forums.unrealengine.com/t/duplicate-definitions-with-3rd-party-glib/472215/1 "2020-10-01T00:07:51Z")

</div>

Hi,  
I wrote a custom [module](https://pastebin.com/nf94i7Sc) for a plugin that manages adding my own library based on gstreamer.

In there I am adding simply all static libraries that come with gstreamer and the include paths. I know that these suffice, since I was able to build executables with this [FindGSTREAMER.cmake](https://pastebin.com/h8qENyMB) that does the same linking. I link my own lib in the module file at lines 38-39, so these include files are actually included in my plugin’s header files.

The important thing is that gstreamer uses glib-2.0. So when including one of my own include files, which does includes over gstreamer header also some glib header, the symbol `GError` gets defined. This symbol seems to also be defined within the unreal engine, so I get a duplicate definition. The highlighted one seems to show the location of the unreal definition:

 ![316689-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/a/18ab2df58b4a92c7a2650071b9b3f7cb4d614720.png)

So what is the best way to resolve this? Before rebuilding the unreal engine, I would try to rename `GError` within glib. But I fear that after resolving that one duplicate definition another will appear, since that isn’t really a solution. Is there a clever way for this within the UE building system?

Update: So I “just” renamed every GError appearence and GThreadPool. I am sry, but please just please uphold to the recommendations and create namespaces… please.

---

<div class="post-metadata">

**Author:** ![KWMHP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KWMHP](https://forums.unrealengine.com/u/KWMHP)\
**Post date:** [April 12, 2021, 4:54pm UTC](https://forums.unrealengine.com/t/duplicate-definitions-with-3rd-party-glib/472215/2 "2021-04-12T16:54:09Z")

</div>

Just in case this is still relevant or someone has the same issue  
I think the easiest way to “fix” the issue is to use defines to replace duplicates.  
If I remember correclty, this is even done somewhere in the engine before inclufing some SSL headers.

Basically add

```
#define GError GError_TEMP
#define GThreadPool GThreadPool_TEMP

```

befoe your third party include.  
You can undef them again after the include and use GError\_Temp (or whatever you decided to use) in your Code.

Hope this helps someone in the future

Kim

---

<div class="post-metadata">

**Author:** ![sealfoss](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sealfoss](https://forums.unrealengine.com/u/sealfoss)\
**Post date:** [April 19, 2024, 4:05am UTC](https://forums.unrealengine.com/t/duplicate-definitions-with-3rd-party-glib/472215/3 "2024-04-19T04:05:22Z")

</div>

You are a gd ninja. Jedi master right here fr fr
