I am trying to create an application with GLFW and BGFX but I am getting these errors:
LNK2019 unresolved external symbol __imp__stdio_common_vsscanf referenced in function sscanf
LNK2019 unresolved external symbol __imp_strspn referenced in function glfwUpdateGamepadMappings
LNK2019 unresolved external symbol __imp_strncpy referenced in function glfwWindowHintString
LNK2001 unresolved external symbol __imp_strncpy
LNK2001 unresolved external symbol __imp_strncpy
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK2001 unresolved external symbol __imp_calloc
LNK1120 4 unresolved externals
All error are from glfw3.lib. I have linked files: bx.lib bimg.lib bimg_decode.lib bgfx.lib glfw3.lib;
. I have also attempted to use glfw3native.h but it doesn't do anything.
Here is my code:
#include <iostream>
#define ENTRY_CONFIG_IMPLEMENT_MAIN 1
#include <bgfx/bgfx.h>
#include <GLFW/glfw3.h>
int main()
{
if (!glfwInit())
{
std::cerr << "GLFW Initialisation failed" << std::endl;
return false;
}
GLFWwindow* MainWindow = glfwCreateWindow(1920, 1080, "bgfx_test", NULL, NULL);
glfwMaximizeWindow(MainWindow);
if (MainWindow == NULL)
{
glfwTerminate();
return false;
}
bgfx::Init bgfxInit;
bgfxInit.type = bgfx::RendererType::OpenGL;
bgfxInit.vendorId = BGFX_PCI_ID_NVIDIA;
bgfxInit.deviceId = 0;
bgfxInit.capabilities = UINT64_MAX;
bgfxInit.debug = true;
bgfxInit.profile = true;
bgfxInit.resolution.width = 1920;
bgfxInit.resolution.height = 1080;
glfwMakeContextCurrent(MainWindow);
while (!glfwWindowShouldClose(MainWindow))
{
glfwPollEvents();
glfwSwapBuffers(MainWindow);
}
}
Can someone please tell me what I have done wrong or why I am getting these errors? I am also new to GLFW and BGFX.
You should be linking glfw3_mt.lib
instead of glfw3.lib
as you are using Multi-threaded Debug instead of Multi-threaded Debug DLL.