I want to write my own (simple) game engine with OpenGL. I use GLEW and GLFW and so far linked it successfully.

Should the engine or the respective game (which depends on the engine) include GLFW and GLEW?

Ultimately I would like to create a library out off my engine and include it into my game, but I'm not quite sure if that is possible, if its the case, that the engine should depend on GLFW and GLEW. Would I have to link all the libraries that are neccessary for GLEW and GLFW into the game plus the engine-lib itself?

  • \$\begingroup\$ Are you intending to do the entire thing in C\C++? \$\endgroup\$
    – Pikalek
    Jul 24, 2016 at 15:00
  • \$\begingroup\$ Yes, in C++ on windows using code::blocks \$\endgroup\$
    – hans
    Jul 24, 2016 at 15:35
  • 5
    \$\begingroup\$ Remove the "should"s from this question and ask directly about what you're trying to achieve. Are you asking how to make GLFW be a dependency of a fully-encapsulated engine library? Asking if you should is an open-ended opinion and not a good fit for this site. \$\endgroup\$ Jul 24, 2016 at 20:33
  • \$\begingroup\$ But my primary question was whether it is adviseable to include the windowing system and glew into the engine, or rather include them into the depending project. \$\endgroup\$
    – hans
    Jul 24, 2016 at 20:50

2 Answers 2


This would depend on whether your game uses direct calls to the bindings or not. So if your library deals with all low level stuff itself, you build it, link to your game and you are good to go, no need for extra linking of GLFW, GLEW, etc. But going this way your game will not have direct access to the recources and functions these helper libraries give. If you are working alone on your library and game, and you are doing it just as a hobby, I'd recommend not to bother yourself with lib/game separation. Just create one project with your game and have all the low level stuff needed at hand.


It's been a while since I've done this sort of thing, but I believe it depends on whether you are using static or dynamic libraries & the GLFW build guide seems to back that up:

GLFW is essentially a wrapper of various platform-specific APIs and therefore needs to link against many different system libraries. If you are using GLFW as a shared library / dynamic library / DLL then it takes care of these links. However, if you are using GLFW as a static library then your executable will need to link against these libraries.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .