undefined reference to `__mingw_vsscanf' while trying to link GLFW statically on VScode

43 views Asked by At

I have been trying to set up my OpenGL, GLFW and glad project for some days now and have not been met with success. At first I was getting "undefined reference to 'glfwInit()'" while trying to use "glfw-3.4.bin.WIN64" then I tried using "glfw-3.4.bin.WIN64" which got me to the error in the title(undefined reference to `__mingw_vsscanf').
The compiler I am using is MinGW's g++ 32-bit version(6.3.0)
This is my file structure:

-root:
    -.vscode:
        tasks.json
    -build:(empty)
    -include:
        -glad:
            glad.h
        -GLFW:
            glfw3.h
            glfw3native.h
        -KHR:
            khrplatform.h
    -src:
        glad.c
        main.cpp
    .gitignore
    libglfw3.a

These are the contents of tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:/MinGW/bin/g++.exe",
            "args": [
                "-std=c++17",
                "-I${workspaceFolder}/include",
                "${workspaceFolder}/src/glad.c",
                "${workspaceFolder}/src/main.cpp",
                "${workspaceFolder}/libglfw3.a",
                "-o",
                "${workspaceFolder}/build/output.exe",
                "-lgdi32"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "C:/MinGW/bin/g++.exe"
        }
    ]
}

And finally this is the error I get everytime I try to compile:

c:path/to/Senior-Project/libglfw3.a(context.c.obj):context.c:(.text+0x1b): undefined reference to `__mingw_vsscanf'

I tried

  • First was using the GFLW64 with MinGW32 and that was causing "GFLW-init()" undefined reference error
  • Changed to GLFW32 and that caused the "undefined reference to `__mingw_vsscanf'" error
0

There are 0 answers