How to fix "Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)"

huudiep picture huudiep · Dec 11, 2015 · Viewed 12k times · Source

It appears you are building natively for Linux with GCC

Cocos2dx on Linux : "cmake -G 'CodeBlocks - Unix Makefiles'
-- OpenGL include dirs: /usr/include
CMake Error at /usr/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.4/Modules/FindGLEW.cmake:44 (find_package_handle_standard_args)
  cocos2d/cmake/Modules/CocosBuildHelpers.cmake:44 (find_package)
  cocos2d/CMakeLists.txt:190 (cocos_find_package)

-- Configuring incomplete, errors occurred!
See also "/home/daw/Dev/cocos2d-x-3.9/allProject/testC/CMakeFiles/CMakeOutput.log".

Answer

dante picture dante · Mar 9, 2018

It's quite an old question but I was looking for solution of the same issue and came here, so maybe my answer will help someone in future.

In Ubuntu 17.10 it was enough to install libglew-dev package to solve this

sudo apt install libglew-dev