I’ve spent last 2 days googling and trying many options and yet didn’t manage to get GLFW working. I’m using CLion with CMake to build a simple program:
#define GLFW_INCLUDE_VULKAN
#include <glfw3.h>
#include <iostream>
int main() {
glfwInit();
return 0;
}
And I used to veriants of CMakeList.txt
- Using GLFW Source Package:
cmake_minimum_required(VERSION 3.17)
project(ultima)
set(CMAKE_CXX_STANDARD 17)
add_executable(${PROJECT_NAME} main.cpp )
set(GLFW_INCLUDE_DIRS C:/somewhere/tools/glfw-3.3.4/include/GLFW)
include_directories(${GLFW_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${GLFW_INCLUDE_DIRS}/glfw3.h)
With that I’m getting error like this:
main.cpp:13: undefined reference to
glfwInit’`
- Using Windows Binaries:
cmake_minimum_required(VERSION 3.17)
project(ultima)
set(CMAKE_CXX_STANDARD 17)
add_executable(${PROJECT_NAME} main.cpp )
set(GLFW_DLL_DIRS C:/somewhere/tools/glfw-3.3.4.bin.WIN64/lib-mingw-w64)
include_directories(${GLFW_DLL_DIRS})
target_link_libraries(${PROJECT_NAME} ${GLFW_DLL_DIRS}/libglfw3dll.a)
And with that I’m getting this:
main.cpp:2:10: fatal error: glfw3.h: No such file or directory
At this point I have to ask this in related forums and I’m out of options to search for.