# COM CoInitialize Warning on glfwInit call

**URL:** <https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541>\
**Category:** support\
**Created:** [April 18, 2020, 9:34pm UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541 "2020-04-18T21:34:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wabuilderman](https://avatars.discourse-cdn.com/v4/letter/w/54ee81/32.png) [@wabuilderman](https://discourse.glfw.org/u/wabuilderman)\
**Post date:** [April 18, 2020, 9:34pm UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541/1 "2020-04-18T21:34:27Z")

</div>

I created a new test project with Visual Studio 2017, changed the settings as described below.

- Additional Include Directories: C:\Users\Owner\Documents\Visual Studio 2017\Libraries\glfw-3.3.2.bin.WIN64\include;%(AdditionalIncludeDirectories)
- Linker - Additional Library Directories: C:\Users\Owner\Documents\Visual Studio 2017\Libraries\glfw-3.3.2.bin.WIN64\lib-vc2017;%(AdditionalLibraryDirectories)
- Linker - Additional Dependencies: opengl32.lib;glfw3.lib;%(AdditionalDependencies)

I then copy-pasted the code off of [https://www.glfw.org/documentation.html](https://www.glfw.org/documentation.html) into main.cpp. I then compiled the program with the Debug configuration, targeting the x64 platform.

The program ran perfectly fine, however, within the VS output window, it displayed the following:

```
onecore\com\combase\objact\objact.cxx(836)\combase.dll!00007FFD097B3D87: (caller: 00007FFD097B2C0C) ReturnHr(1) tid(4724) 800401F0 CoInitialize has not been called.
onecore\com\combase\objact\objact.cxx(836)\combase.dll!00007FFD097B3D87: (caller: 00007FFD097B2C0C) ReturnHr(2) tid(4724) 800401F0 CoInitialize has not been called.
onecore\com\combase\objact\objact.cxx(836)\combase.dll!00007FFD097B3D87: (caller: 00007FFD097B2C0C) ReturnHr(3) tid(4724) 800401F0 CoInitialize has not been called.
onecore\com\combase\objact\objact.cxx(836)\combase.dll!00007FFD097B3D87: (caller: 00007FFD097B2C0C) ReturnHr(4) tid(4724) 800401F0 CoInitialize has not been called.

```

These warnings persist in the Release configuration.

Stepping through the example using the debugger, I found that these are generated after the call to glfwInit.

Is there any solution to this?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [April 19, 2020, 11:52am UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541/2 "2020-04-19T11:52:00Z")

</div>

Do you get the same warnings on any of the tests or example projects in GLFW, or in this starter project: [GitHub - juliettef/GLFW-CMake-starter: Use CMake to create a project with GLFW - Multi-platform Windows, Linux and MacOS.](https://github.com/juliettef/GLFW-CMake-starter) ?

I heard someone had a similar issue which I was unable to replicate:

> [@"CoInitialize has not been called" message on XInputGetCapabilities call](https://discourse.glfw.org/t/coinitialize-has-not-been-called-message-on-xinputgetcapabilities-call/1363):
>
> Hello, I’ve recently noticed this string in my project’s output: onecore\com\combase\objact\objact.cxx(834)\combase.dll!00007FF824B17213: (caller: 00007FF824B164D6) ReturnHr(1) tid(1bd8) 800401F0 CoInitialize has not been called. After some quick debugging, I’ve tracked down the line causing said string to be printed: if (XInputGetCapabilities(index, 0, &xic) != ERROR\_SUCCESS) continue; line 553 in win32\_joystick.c from glfw3.3 Here’s the callstack: | |Engine.dll!\_glfwDetectJoystickConne…

If you can replicate the issue with any of the tests/examples etc. then it might be an issue with GLFW on your particular configuration, so knowing the exact OS details would be useful (Windows version).

---

<div class="post-metadata">

**Author:** ![wabuilderman](https://avatars.discourse-cdn.com/v4/letter/w/54ee81/32.png) [@wabuilderman](https://discourse.glfw.org/u/wabuilderman)\
**Post date:** [April 19, 2020, 6:21pm UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541/3 "2020-04-19T18:21:46Z")

</div>

I cloned that starter project, built it with cmake, yielding the following info:

```
Building for Visual Studio 15 2017
Selecting Windows SDK Version 10.0.17763.0 to target Windows 10.0.18363.
The C compiler identification is MSVC 19.16.27039.0
The CXX compiler identification is MSVC 19.16.27039.0

```

I am using Windows 10 Home x64-bit, version 1909, build 18363.778

The problem persisted when I compiled and ran the solution (targeting Debug Win32)

Just in case it’s relevant, I am compiling and running this on an Intel Core i3-8100.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [April 19, 2020, 7:57pm UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541/4 "2020-04-19T19:57:42Z")

</div>

Thanks - I don’t think this is a bug in GLFW as it’s not using COM directly, but since two people have seen it it may be worth filing a [GLFW issue](https://github.com/glfw/glfw/issues). I can do this for you if you don’t have a Github account.

There are a few things I can think of which might cause this, one being a driver bug and the other being an external application which injects itself into apps.

Basically CoInitializeEx isn’t being called by something which uses COM: [https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex](https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex)

---

<div class="post-metadata">

**Author:** ![wabuilderman](https://avatars.discourse-cdn.com/v4/letter/w/54ee81/32.png) [@wabuilderman](https://discourse.glfw.org/u/wabuilderman)\
**Post date:** [April 19, 2020, 10:34pm UTC](https://discourse.glfw.org/t/com-coinitialize-warning-on-glfwinit-call/1541/5 "2020-04-19T22:34:55Z")

</div>

Okay. I filed the issue. Hopefully this will prove to be recreatable in a few more cases. Thankfully this seems to not a have a significantly negative impact.  
[https://github.com/glfw/glfw/issues/1681](https://github.com/glfw/glfw/issues/1681)
