The program gets stuck at the glfwInit()
function. However, there are no error messages and glfwInit()
doesn't come to a stop. It's like the main thread is sleeping or run into an infinite loop. This problem seems not to be project-specific because I tried running a program that I hadn't changed in days where the same problem occurred (this program worked also fine). I am using Visual Studio 2019.
Here is the code of my main-function which should initiate GLFW:
int main() {
int width, height;
//Everything until this function will not execute and the program won't stop from its self.
if (!glfwInit()) {
std::cout << "ERROR::GLFW::Could not be initialized!" << std::endl;
}
setUpWindow();
GLFWwindow* window = createWindow(800, 800, "OpenGL Advanced");
if (window == nullptr) {
glfwTerminate();
return 2;
}
glfwMakeContextCurrent(window);
setUpListener(window);
bool gladIsLoaded = loadGlad();
if (!gladIsLoaded) {
glfwTerminate();
return 3;
}
setUpOpenGL();
startRenderLoop(&width, &height, window);
glfwTerminate();
return 1;
}
This is the call stack:
ntdll.dll!NtDeviceIoControlFile() Unknown
KernelBase.dll!DeviceIoControl() Unknown
kernel32.dll!DeviceIoControlImplementation() Unknown
hid.dll!00007ff86b631c2b() Unknown
hid.dll!00007ff86b631a1b() Unknown
dinput8.dll!00007ff83367492b() Unknown
dinput8.dll!00007ff833674648() Unknown
dinput8.dll!00007ff833674401() Unknown
dinput8.dll!00007ff833671f87() Unknown
dinput8.dll!00007ff83367424d() Unknown
dinput8.dll!00007ff833671037() Unknown
dinput8.dll!00007ff833678f1f() Unknown
dinput8.dll!00007ff8336790c6() Unknown
OpenglAdvanced.exe!_glfwInitJoysticksWin32() C
OpenglAdvanced.exe!_glfwPlatformInit() C
OpenglAdvanced.exe!glfwInit() C
OpenglAdvanced.exe!main() Line 48 C++
OpenglAdvanced.exe!invoke_main() Line 79 C++
OpenglAdvanced.exe!__scrt_common_main_seh() Line 288 C++
OpenglAdvanced.exe!__scrt_common_main() Line 331 C++
OpenglAdvanced.exe!mainCRTStartup() Line 17 C++
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
I had the same issue, updating to the latest version (from 3.3.2 to 3.3.6) fixed the problem.