Xcode opens window twice, unless I restart Xcode.

I have a Vulkan project on Xcode which should open one window.

I quit Xcode, open Xcode, open my project and then run my project. This results in one window opening.

Then I close the window. Run the project and two windows open on top of each other.

I again quit Xcode, open Xcode, open my project and then run my project. This results in one window opening.

So in order to get my project to run properly (open only one window), I have to restart Xcode.

I have an older Vulkan project I'm working on in Xcode, which opens properly. I'm setting up this project the same way as this older project.

I am following the Setup Vulkan (MoltenVK) With GLFW On Mac Using Xcode - Vulkan Graphics/Games Programming Youtube video. https://www.youtube.com/watch?v=_j3ugZwT3Vc&t=19s

I have my project up on Github, if someone could take a look and tell me what may be wrong with it. https://github.com/flocela/BlackSpider

Thank you. : )

Answered by FloBee in 846283022

In order for Vulkan to create only 1 window instead of 2, I added a sleep_for method as the first line in my main method. This is a work around. I'm not sure why it works. (I didn't come up with it myself.)

int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
...
}
Accepted Answer

In order for Vulkan to create only 1 window instead of 2, I added a sleep_for method as the first line in my main method. This is a work around. I'm not sure why it works. (I didn't come up with it myself.)

int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
...
}
Xcode opens window twice, unless I restart Xcode.
 
 
Q