0

I recently started following a tutorial for modern openGL but I'm stuck at the very beginning since I cant get to link GLFW. Each Time I try to compile my code, it gives me three errors :

Error   1   error LNK2019: unresolved external symbol _glfwInit referenced in function _main
Error   2   error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
Error   3   error LNK1120: 2 unresolved externals

What I did : I put the header file in the nclude file of my VS install directory I put the glfw3.dll, glfw3.lib and glfw3dll.lib files in my lib file I linked to glfw3dll.lib and opengl32.lib in the Additional Dependencies section of the options.

Here is my code :

#include <thread>
#include <glfw3.h>

using namespace std;

int main()
{
    glfwInit();
    this_thread::sleep_for(chrono::seconds(1));
    glfwTerminate();

    return 0;
}

Any kind of help is greatly appreciated,

mindoo

mindoo
  • 33
  • 1
  • 1
  • 7
  • possible duplicate of [Visual Studio 11 GLFW external symbol error](http://stackoverflow.com/questions/20223198/visual-studio-11-glfw-external-symbol-error) – user4581301 Sep 14 '15 at 19:16
  • Linker errors mean a library or object file is missing. You think you've added them, but no such luck. Did you specify the source directory for the lib files? Are you trying to link 32 bit libs in a 654 bit project? – user4581301 Sep 14 '15 at 19:26
  • What do you mean by source directory ? If you mean the .lib or .dll file then yes. I'm trying to link a 64 bit version, where can i see if my project is 64 bit ? – mindoo Sep 15 '15 at 17:29
  • Oh and regarding the possible duplicate, I tried what he did but it didn't work. – mindoo Sep 15 '15 at 17:30
  • 1
    I mean specify to VS where to find the lib files. (Properties-> Configuration Properties->VC++ Directories Library Directories). If aiming for a for a 64 bit executable, `opengl32.lib` is not going to link in a 64 bit executable if I'm interpreting the 32 in the file name correctly. Though I would expect some sort of "bad library" error message. Look for the 64 bit version of the library. – user4581301 Sep 15 '15 at 17:43
  • And on the dupe comment, I removed the close vote once I'd read the other question a bit more thoroughly, but missed the comment it leaves. – user4581301 Sep 15 '15 at 17:45
  • I tried linking to opengl64.lib but it gave me another link error so I tried looking up the lib files on the web but I did not find them. Do you have an idea of where I could find them ? Otherwise, I tried linking to the files where I have al my includes and libs and linked back up to the opengl32.lib file but it still keeps on giving me that one error. I think its probably because of the opengl.lib file. Oh and thanks for removing the closing vote. – mindoo Sep 15 '15 at 18:56
  • 1
    Did a bit more reading. Apparently the MS openGL implementation ***does*** call the 64 bit version `opengl32.lib`. Not that bright in my unhumble opinion, but there's likely legacy reasons for the decision. Anyway, explains why you didn't get a bad library error. The 32 bit version is in another folder. Make sure you have the Library Directories property pointed at the correct folder. If you can give me a link to the tutorial you tried to use, I'll look at it after work and try to see what's wrong. – user4581301 Sep 15 '15 at 21:01
  • Ok, so here is the link to the tutorial : https://open.gl/context – mindoo Sep 16 '15 at 12:59
  • That tutorial is really thin on the set up. Still messing around to get a windows SDK that includes opengl32.lib – user4581301 Sep 17 '15 at 15:34
  • I know, its kinda too basic for opengl beginners like me. – mindoo Sep 17 '15 at 16:42
  • @user4581301 So, did you find what were looking for ? – mindoo Sep 30 '15 at 13:16
  • No, I'm afraid I lost the thread of this one. – user4581301 Sep 30 '15 at 16:16

0 Answers0