3

I'm having a few issues getting GLFW3 set up. I've downloaded the 64-bit binaries from the official site, added glfw3.dll, glfw3.lib and glfw3.h to their respective places, specified the proper include, and added the appropriate linker input to my project. However, when I test the library with glfwInit(), VS spits this out:

error LNK1104: cannot open file 'glfw3.lib' Path/To/Project

My guess was that VS didn't know what directory the library was in, but seeing as it's in the IDE's own lib folder, I don't think this is it. Does anyone have any suggestions? Sorry if this has already been solved, I got in as deep as to read the steps of compilation before I gave up searching.

Edit: I also changed the solution platform to x64, since I am using the 64-bit GLFW binaries.

  • 1
    Say what? You installed that lib into the actual path where Visual Studio is installed? You shouldn't do that. Ideally you would establish a shared directory on your development system for all 3rd party libraries. I use `NothingInc/Dev/Lib/` and `NothingInc/Dev/Include/` for heavily re-used stuff. Visual Studio is then configured to look in those two locations for extra includes and libraries that a lot of my projects share in common. For everything else I do [this](http://stackoverflow.com/questions/20873321/visual-studio-2012-error-lnk1104-cannot-open-file-glew32-lib/20873711#20873711) – Andon M. Coleman Aug 31 '15 at 00:02
  • @AndonM.Coleman I was following a guide, am by no means an expert VS user. I'll try that out and report back. Would I still have to specify the libraries in linker input? – Patrick Bartlett Aug 31 '15 at 00:15
  • Yes, though technically in MSVC you can use `#pragma comment (lib, glfw3.lib)` from any source file to tell the linker it needs this library. I use this quite a bit to handle different build configurations with the pre-processor instead of messing with project settings. – Andon M. Coleman Aug 31 '15 at 00:18
  • @AndonM.Coleman well that solved it, thank you for your time – Patrick Bartlett Aug 31 '15 at 00:21

1 Answers1

1

Following Andon M. Coleman's advice, I moved the headers and library folders to a new directory outside of Visual Studio's built-in ones (D:\opengl-wrappers\lib & D:\opengl-wrappers\include, for example). After including those libraries in the project settings (C/C++->General-> Additional Include Directories and Linker->General->Additional Library Directories), everything compiled beautifully.