Thread: help getting GLEW/GLFW setup in Visual Studio

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    87

    help getting GLEW/GLFW setup in Visual Studio

    I'm trying to get OpenGL going in Visual studio C++ 2010 Express and I downloaded GLEW, GLFW, but I am having issues including them in proper pathway. For e.g. on GLEW instructions, it says to install : "include/GL/glew.h to {VC Root}/Include/GL

    but I don't have a GL directory just this:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include.

    I'm using 64-bit Windows 7. I need simple help how to include these libraries in the pathway.

  2. #2
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    What else is needed, I am stuck getting these libraries set up. Appreciate all the help.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    It seems that the GL headers comes with Windows SDK. I have my include files from Windows SDK in the following directory: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

    And i also have a gl folder in the Include folder there with GL.h and GLU.h

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Shakti View Post
    It seems that the GL headers comes with Windows SDK. I have my include files from Windows SDK in the following directory: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

    And i also have a gl folder in the Include folder there with GL.h and GLU.h
    Those, in general, tend to have an OpenGL version outdated by decades, afaik.

    GLEW (or other libraries) interact with the driver directly to get function pointers for the new functionality.
    GLFW is just a little framework that eases the process of ..say.. creating windows and contexts in a portable way.

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    So I also downloaded Windows SDK, and I want to get GLEW working, but are they outdated as manasij7479 indicates? But GLU, GL not same as GLUT, right? I would like to use GLEW and GLFW (as oppose to FreeGLUT and I understand GLUT has not been updated in more than a decade) as a good tutorial I found is teaching modern OpenGL (so 3, 4). And it tells me to use CMake. I find it confusing but I'll give it a go first. Can I just build manually w/ Visual Studio C++ 2010 Express that I'm using?

  6. #6
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    So I found another tutorial and may use both (as this new one focuses on graphics programming in general), but uses OpenGL when necessary, but it chooses to use the windowing scheme w/ FreeGLUT as oppose to another tutorial (that focuses on modern OpenGL so versiion 3,4) that uses the windowsing scheme: GLFW. Can I have both co-exist in .../Windows SDK/GL/ ? Then there's also a header of:
    Code:
    #include <glload/gl_3_2_comp.h>
    . This is overwhelming to get started, so I should include glload lib into .../Windows SDK/GL/ as well? Any help please.

    Also in VS C++ 2010 Express that I'm using, I tried build a simple program, but I get these errors:
    'playground.exe': Loaded 'C:\Users\Documents\Visual Studio 2010\Projects\playground\Debug\playground.exe', Symbols loaded.
    'playground.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
    'playground.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
    'playground.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
    'playground.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
    'playground.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
    The program '[10524] playground.exe: Native' has exited with code 0 (0x0).

    Why do they make it so hard to set up VS, OpenGL...
    Last edited by monkey_c_monkey; 08-01-2012 at 04:51 PM.

  7. #7
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    I just included
    Code:
    #include <Windows.h>
    , these are the headers I have so far:
    Code:
    #include <stdlib.h>
    #include <GL/glew.h>
    #include <GL/glfw.h>
    #include <Windows.h>
    #include <GL/glm/glm.hpp>
    but now I'm getting these errors when building the program:
    1>------ Build started: Project: playground, Configuration: Debug Win32 ------
    1>main.obj : error LNK2019: unresolved external symbol _glfwGetWindowParam referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwGetKey referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwEnable referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwSetWindowTitle referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwOpenWindowHint referenced in function _main
    1>main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
    1>c:\users\documents\visual studio 2010\Projects\playground\Debug\playground.exe : fatal error LNK1120: 11 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Also, I don't need to have two versions of Windows SDK, right? I have:
    1) C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
    2) C:\Program Files\Microsoft SDKs\Windows\v7.0
    Last edited by monkey_c_monkey; 08-01-2012 at 05:42 PM.

  8. #8
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    You need to LINK that library, not only include its headers.

  9. #9
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    What is meant by linking the library? I already added the GLEW/GLFW into the C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\gl\ and I also included glm as well as the lib files from GLEW/GLFW into C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\. And should I delete v7.0 in Program Files (64bit) of Windows SDK. I'm using Program(x86) Windows SDK which is v7.0a or should I keep both. I'm using Windows 7 64-bit.

    I opened in VS, Properties->Linker and these are the dependencies I have: kernel32.lib
    user32.lib
    gdi32.lib
    winspool.lib
    comdlg32.lib
    advapi32.lib
    shell32.lib
    ole32.lib
    oleaut32.lib
    uuid.lib
    odbc32.lib
    odbccp32.lib

    Please I need major help anyone
    Last edited by monkey_c_monkey; 08-01-2012 at 08:34 PM.

  10. #10
    Registered User
    Join Date
    Jul 2012
    Posts
    87
    I tried to link: glu32.lib, but in the System32 dir, I only have: GlU32.Lib, is this the same thing?

    Also, now I turned on warnings and the messages I get when building:
    1>------ Build started: Project: playground, Configuration: Debug Win32 ------
    1> main.cpp
    1>c:\users\documents\visual studio 2010\projects\playground\playground\main.cpp(169): error C2220: warning treated as error - no 'object' file generated
    1>c:\users\documents\visual studio 2010\projects\playground\playground\main.cpp(169): warning C4100: 'y' : unreferenced formal parameter
    1>c:\users\documents\visual studio 2010\projects\playground\playground\main.cpp(169): warning C4100: 'x' : unreferenced formal parameter
    1>c:\users\documents\visual studio 2010\projects\playground\playground\main.cpp(180): warning C4100: 'height' : unreferenced formal parameter
    1>c:\users\documents\visual studio 2010\projects\playground\playground\main.cpp(180): warning C4100: 'width' : unreferenced formal parameter
    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\freeglut_std.h(612): warning C4505: 'glutInit_ATEXIT_HACK' : unreferenced local function has been removed
    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\freeglut_std.h(614): warning C4505: 'glutCreateWindow_ATEXIT_HACK' : unreferenced local function has been removed
    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\freeglut_std.h(616): warning C4505: 'glutCreateMenu_ATEXIT_HACK' : unreferenced local function has been removed
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Last edited by monkey_c_monkey; 08-01-2012 at 11:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to setup visual c++ 6.0 to compile and run a C program?
    By BrandNewDeipz in forum C Programming
    Replies: 8
    Last Post: 06-20-2012, 02:58 PM
  2. Visual Studio Setup
    By Tonto in forum Tech Board
    Replies: 4
    Last Post: 12-13-2008, 05:29 PM
  3. Problems with GLEW
    By nightcrawler in forum Game Programming
    Replies: 0
    Last Post: 05-22-2008, 03:42 AM
  4. visual studio 6 and visual studio.net difference
    By gemini_shooter in forum Tech Board
    Replies: 5
    Last Post: 02-04-2006, 01:32 AM
  5. Replies: 1
    Last Post: 05-26-2004, 09:59 AM