am setting up GLEW and GLFW on clion, glfw worked fine but I have a trouble with glew. After linking glew, I built the code and worked fine, but when using any glew function then run the code, a runtime error shows up before executing any line code.
I tried deleting every glew file on my computer then reinstalling glew as proposed in this previous problem. I thought the problem might be a linking problem so I searched for a proper way to link glew. I found this old question, but the glew version used in his case is different from the one I've downloaded from the official site which has Cmake ready to link.
Cmake code:
cmake_minimum_required(VERSION 3.12)
project(graphics)
set(CMAKE_CXX_STANDARD 14)
add_executable(graphics main.cpp)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(glfw)
target_link_libraries(graphics glfw)
find_package(OpenGL REQUIRED)
target_link_libraries(graphics OpenGL::GL)
add_subdirectory(glew-2.1.0/build/cmake)
target_link_libraries(graphics glew)
find_package(glew REQUIRED)
The code I try to run:
#include <iostream>
using namespace std;
#include "glew-2.1.0/include/GL/glew.h"
int main()
{
glewInit();
return 0;
}
am still thinking it may be a linking problem but I don't have much experience with cmake. hope you help me, thanks in advance
EDIT: Problem fixed. It was a missed dll file. This file is glew32d.dll which created by clion after linking, but Clion couldn't use it so I put it in the project directory. I also tried to put in MinGW/bin and worked. The program I used to figure out the missed dll file found in the comments.