0

I have a testing project set up for bgfx, which I was trying to learn. Problem is, i can't get GLFW to initialize properly.

The code snippet currently existing is this:

#include <bgfx/bgfx.h>
#include <GLFW/glfw3.h>
#include <iostream>

#define WINDOW_WIDTH 1920
#define WINDOW_HEIGHT 1080

int main(int argc, char const *argv[])
{
    std::cout << "Initializing GLFW\n";
    glfwInit();

    std::cout << "Creating window\n";
    GLFWwindow *window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Hello World", NULL, NULL);

    std::cout << "Initializing bgfx\n";
    bgfx::init();

    std::cout << "Exiting" << std::endl;
    return 0;
}

The console execution is this:

cmake . && make && valgrind --leak-check=full --log-file="yay.log" ./BGFX_Testing

-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/entropy/CLionProjects/BGFX_Testing
[ 50%] Building CXX object CMakeFiles/BGFX_Testing.dir/main.cpp.o
[100%] Linking CXX executable BGFX_Testing
[100%] Built target BGFX_Testing
Initializing GLFW
libdecor-gtk-WARNING: Failed to initialize GTK
Failed to load plugin 'libdecor-gtk.so': failed to init
Creating window
Initializing bgfx
Exiting

Notes: If needed i can provide the CMakeList.txt and the valgrind yay.log (1055) The only question I have found with a similar issue is this, which has no verified answer, one answer that seems useful, which didn't change my problem.

OS Info: Kernel: 6.6.34-1-MANJARO CPU: AMD Ryzen 7 5700X (16) @ 3.400GHz GPU: AMD ATI Radeon RX6700XT

I'd appreciate any (reasonable) Idea on what i could do to solve this issue. Thanks.

Things I have tried already:

  1. Checking libdecor installation

    sudo pacman -S libdecor

  2. Checking libdecor dependencies

    ldd /usr/lib/libdecor-gtk.so (all installed)

  3. Installing GLFW-X11 and -Wayland (Each alone or both at once, didn't change the issue)

    sudo pacman -S glfw-x11 sudo pacman -S glfw-wayland

  4. Sleeping over it

1 Answer 1

0

why do you use cmake and building like from console not by mouse clicking? could you try Rider or other IDE, where you can see compiler arguments, probably there is an absent about linked libs, check there example of such lib arguments, they must be present in output. smth like '-l lfilename.so'

Link .so file to .cpp file via g++ compiling

1
  • You can use CMAKE_VERBOSE_MAKEFILE to see the explicit CLI steps used by CMake, which I currently don't need. The issue you are hinting at however would be noticed by the linker as it needs all statically and dynamically linked libraries to be present in link-time to ensure that all bindings are working correctly. Why don't I use mouse clicking: I like not having to move my hands constantly between mouse and keyboard when coding. Hotkeys possibility to quickly switch between editor and I can do changes to the build process or similar relatively quickly. Its is a personal preference.
    – Entropy
    Commented Jul 5 at 23:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.