admin管理员组

文章数量:1122832

I'm working on a very simple Vulkan application. Up until now, I've been linking with the GLFW DLL that I installed via my OS's package manager (and I haven’t had any issues with that). After downloading and compiling the GLFW source code to link statically, my program still compiles and runs just fine, but no window appears during runtime.

I've tried calling glfwMakeContextCurrent() and glfwShowWindow(), but neither resolved the issue.

A very simple test program that I wrote:

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

int main(void)
{
  if(glfwInit() != GLFW_TRUE)
  {
    return 1;
  }

  GLFWwindow *window = glfwCreateWindow(800, 600, "Test Window", NULL, NULL);
  if(window == NULL)
  {
    return 1;
  }

  while(!glfwWindowShouldClose(window))
  {
    glfwPollEvents();
  }

  glfwDestroyWindow(window);
  glfwTerminate();
}

Compiling and running with the following command displays the window just fine

gcc main.c -o main -lglfw -lvulkan

While compiling and running like this does not

gcc main.c -o main -I./glfw/include -L./glfw/build/src -lglfw3 -lvulkan -lm

I’m wondering if anyone has any insight into what the problem may be. Thanks!

I'm working on a very simple Vulkan application. Up until now, I've been linking with the GLFW DLL that I installed via my OS's package manager (and I haven’t had any issues with that). After downloading and compiling the GLFW source code to link statically, my program still compiles and runs just fine, but no window appears during runtime.

I've tried calling glfwMakeContextCurrent() and glfwShowWindow(), but neither resolved the issue.

A very simple test program that I wrote:

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

int main(void)
{
  if(glfwInit() != GLFW_TRUE)
  {
    return 1;
  }

  GLFWwindow *window = glfwCreateWindow(800, 600, "Test Window", NULL, NULL);
  if(window == NULL)
  {
    return 1;
  }

  while(!glfwWindowShouldClose(window))
  {
    glfwPollEvents();
  }

  glfwDestroyWindow(window);
  glfwTerminate();
}

Compiling and running with the following command displays the window just fine

gcc main.c -o main -lglfw -lvulkan

While compiling and running like this does not

gcc main.c -o main -I./glfw/include -L./glfw/build/src -lglfw3 -lvulkan -lm

I’m wondering if anyone has any insight into what the problem may be. Thanks!

Share Improve this question asked yesterday KafviqKafviq 311 silver badge2 bronze badges New contributor Kafviq is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

Rolling back to the previous release of GLFW (3.3.10) resolved the issue :)

本文标签: cIssues displaying GLFW window when linking with static libraryStack Overflow