2

I'm learning how to use SDL2 and I'm following LazyFoo's tutorials.

I've downloaded the source code from lesson 50, which teaches how to use OpenGL with SDL2(link to tutorial) and tried to execute it, but I got a lot of erros and I don't know what to do!

These are the erros:

Error   11  error LNK1120: 9 unresolved externals   c:\users\felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\Debug\SDL2 Template1.exe SDL2 Template1
Error   2   error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)  c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   3   error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)  c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   4   error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)   c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   5   error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)    c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   6   error LNK2019: unresolved external symbol __imp__glGetError@0 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)  c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   7   error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)  c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   8   error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)    c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   9   error LNK2019: unresolved external symbol __imp__glVertex2f@8 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)   c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Error   10  error LNK2019: unresolved external symbol _gluErrorString@4 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)    c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\50_SDL_and_opengl_2.obj   SDL2 Template1
Warning 1   warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library    c:\Users\Felipe\Desktop\Arquivos\Drawing - Modeling - Coding\Visual Studio 2013\SDL2 Template1\SDL2 Template1\MSVCRTD.lib(cinitexe.obj) SDL2 Template1

I've never used OpenGL, so I have no ideia of what's happening.

What does that means? And how do I fix this?

Deive_Ex
  • 83
  • 2
  • 9

1 Answers1

5

It looks like you are missing a library file, in all probability OpenGL32.lib. If you have that library available, add it to your project.

Check this page, down near the bottom: http://msdn.microsoft.com/en-us/library/windows/desktop/dd318361(v=vs.85).aspx

Logicrat
  • 4,438
  • 16
  • 22
  • How do I do that? The same way I did with SDL2 librarys? And where can I found OpenGL32.li? – Deive_Ex Jul 04 '14 at 20:13
  • @Deive_Ex _' And where can I found OpenGL32.li?'_ Where you have previously installed it perhaps? – πάντα ῥεῖ Jul 04 '14 at 20:25
  • @πάνταῥεῖ That's the thing: I never installed OpenGL. Wasn't it supposed to, like, be in my machine by default or something? – Deive_Ex Jul 04 '14 at 20:29
  • 2
    @πάνταῥεῖ Oh, I searched a little and found a folder called "Windows Kits" inside my ProgramsFiles(x86)(the weird thing is that there's two folders called 8.0 and 8.1 even though I'm using Windows 7), there I found another folder called "gl" and it had the lib and include folders and the OpenGL32.lib file. I added them the same way I added the SDL2, and now I don't get any other error, except for the error 10(the gluErrorString thing) and the warning. – Deive_Ex Jul 04 '14 at 20:34
  • I've been having the same issue...Couldn't find the OpenGL32.lib file anywhere. Thanks for posting that it was in that Windows Kits folder or I would have been lost! – wrigley06 Nov 04 '14 at 00:42