Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: OpenGL Compilation Killing Me - Nvidia

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    10

    OpenGL Compilation Killing Me - Nvidia

    Hey,

    I'm porting an app I've been working on for a project from Linux over to Windows (to see if the Nvidia drivers for OpenCL which are failing terribly on Ubuntu Linux work right in Windows).

    I installed every Nvidia SDK I can think of - I can find include headers, I CAN'T find the libraries (.lib) for a path to add to the linker to link...

    I need ONE function out of OpenGL (and it's part of GLU), and that's simply gluOrtho2D. I'm doing a 2 stage compilation link via command line. The compilation happens okay but the link obviously fails with:
    Code :
    main1.obj : error LNK2019: unresolved external symbol _gluOrtho2D referenced in function _init
    output.exe : fatal error LNK1120: 1 unresolved externals

    A pretty straight forward linker message, I don't have the right OpenGL libs pointed to in the linker path. Right now my linker paths are:
    Code :
    C:\Users\UN\AppData\Local\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\OpenCL\common\lib\Win32
    C:\Users\UN\AppData\Local\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\GLUT"
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib"

    The second path (GLUT) is simply a dir I made in the already existing Nvidia dir to dump the GLUT libs (yeah, it's hack-ish, I know).

    Platform is Win7 x64 (though I'm not using 64 bit libs as far as I know), card is a GTX280. Just can't find the location to link against the Nvidia OpenGL libs. Plenty of headers though...

    Much help is appreciated, this is my first time running OpenGL, OpenCL, GLUT, or Glu on Windows, I typically use Linux or OS X.

    TIA!

    EDIT:
    Yeah, and I realize the 3rd one is the pre-packaged with Windows OpenGL 1.1 lib, which is why it isn't working (no GLU, I believe).

    Also, forgot to mention, the compiler libraries I'm noting in the linker line are:
    Code :
    OpenCL.lib
    OpenGL32.lib
    (should probably just be OpenGL.lib but I can't find it anywhere).

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,792
    GLU is not part of OpenGL. It's a supplementary library that sits on top of OpenGL, not a component. As such, you need to link to it specifically. On Windows, that would be GLU32.lib

    However, I'm concerned about this line:

    I need ONE function out of OpenGL (and it's part of GLU)
    How can you need one function from OpenGL, a function that relies on other OpenGL functions (gluOrtho2D almost certainly just calls glOrtho)? Even moreso when this function only modifies OpenGL state and therefore does nothing that is visible without either rendering something or querying OpenGL state, either of which requires other OpenGL functions.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    10
    Quote Originally Posted by Alfonse Reinheart View Post
    GLU is not part of OpenGL. It's a supplementary library that sits on top of OpenGL, not a component. As such, you need to link to it specifically. On Windows, that would be GLU32.lib

    However, I'm concerned about this line:



    How can you need one function from OpenGL, a function that relies on other OpenGL functions (gluOrtho2D almost certainly just calls glOrtho)? Even moreso when this function only modifies OpenGL state and therefore does nothing that is visible without either rendering something or querying OpenGL state, either of which requires other OpenGL functions.
    I thought GLU was rolled into OpenGL after a certain version? Either way, I can't find OpenGL nor GLU, I was under the impression that I'd get both using the proprietary nvidia drivers. Adding GLU32.lib didn't do it, I'm guessing I'm still missing a path ..

    I mis-spoke about the quoted part, I'm using a OpenGL to draw vertices. As such, I'm using the following OpenGL functions. I meant I needed one more function, that the rest link in fine, the OpenGL functions I'm using are listed below, but apparently I'm not linking against the GLU lib correctly as that isn't.
    Code :
    glClearColor();
    glLoadIdentity();
    gluOrtho2D();
    glViewport();
    glVertex2i(GL_POINTS)
    glBegin()/glEnd()

    The others do not have linker errors, but I'm guessing that's because it's using the out-dated OpenGL version that's packaged with Windows that I'm linked to? I was under the impression that the Nvidia drivers will bring in the latest OpenGL libs which are supported by my gfx card.

    Gahhh, I can't even think straight none-the-less talk straight, tired.

    Synopsis:
    I'm rambling & tired. Point is: I need the GLU lib, I have a lib called "GlU32.lib" (the L isn't capped) inside the Win SDK link location I have listed above, but that's not doing it for me. I get the same error message.

    I've tried both adding GlU32.lib and GLU32.lib as linker libs and while they don't give me errors (they're found), I still get the same linker error for missing gluOrtho2D which is above. I thought I should get a new lib with GLU in it from Nvidia?

    Sorry about the lack of coherent thoughts...

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    Quote Originally Posted by Syndacate View Post
    I've tried both adding GlU32.lib and GLU32.lib as linker libs and while they don't give me errors (they're found), I still get the same linker error for missing gluOrtho2D which is above. I thought I should get a new lib with GLU in it from Nvidia?
    glu32.dll is not coded by nVidia. It comes from Microsoft.
    As for whether it is capitalized or not, it does not matter on the Windows platform. Windows is not like *nix.

    As for glu32.lib, this should come with your IDE and not nVidia. If it does not come with your IDE, then you can get it from Mesa3D (www.mesa3d.org).
    I think it is quite unusual for a IDE to not provide opengl32.lib and glu32.lib.
    Are you using Visual C++ 2010 Express or something else?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    10
    I'm not using any IDE's, notepad++ doesn't come bundled with glu. It needs to compile on windows but need not be tied to that terribly unusable VS MS uses. I do have VS 2010 installed, though, so whatever libs the ide should include should still exist somewhere. I'll look for the glu files when I get home, and check out the mesa site. What's the diff between lib and DLL, just static vs dynamic linked libs such as .a vs .so? I'll look for both, but I believe I need the .lib for static linking. Pretty new to windows dev here. I shouldn't need an ide, though, I'm invoking cl via the cli. I do have vs2010 installed though so any libs it brought should exist, I linked against the win sdk dir as shown above.

    Thanks.

  6. #6
    Intern Contributor nigels's Avatar
    Join Date
    Apr 2000
    Location
    Texas, USA
    Posts
    85
    Quote Originally Posted by Syndacate View Post
    I'm not using any IDE's, notepad++ doesn't come bundled with glu.
    Try and be patient, there tends to be an assumption on Windows that all builds happen in Visual Studio.
    Getting compiler and linker paths can be tricky as a consequence of that.
    I'd expect glu32.lib (just the export lib for glu32.dll) to be part of the Visual Studio install, worth using Cygwin find to track it down...

    - Nigel
    ---
    Regal - as OpenGL ought to be

  7. #7
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    10
    Quote Originally Posted by nigels View Post
    Try and be patient, there tends to be an assumption on Windows that all builds happen in Visual Studio.
    Getting compiler and linker paths can be tricky as a consequence of that.
    I'd expect glu32.lib (just the export lib for glu32.dll) to be part of the Visual Studio install, worth using Cygwin find to track it down...

    - Nigel
    Okay, I'll look now for a lib for it.

    Yeah, not sure why VS is very popular. It's terrible without visual assist at the very least, IMHO. I'd take slick edit, QT Creator (even for non-QT apps, it's great), or even eclipse way before I use VS by choice :-\. Hate getting stuff in SLN format .

    EDIT:
    So I just double checked, result is the same as I have in the synopsis 4 posts up (post #3). I have one file called "GLU32.lib" on my computer, it exists in the Win SDK link which I have the location specified as a link path as shown in post #1, and I specify GLU32.lib on the command line as a library to link against, ie.:
    Code :
    /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" GLU32.lib

    Still same error . I'm guessing that that GLU lib came in with VS 2010. Though CL isn't finding the gluOrtho2D function in there .
    Last edited by Syndacate; 08-19-2012 at 02:33 PM.

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    982
    glu32.lib does exist in "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" unless you've messed up the installation somehow. But for gluOrtho2D, there is actually no need whatsoever to use that function - you can just use glOrtho instead and get the same result.

    Despite all of this, a standard installation of the MS development tools is perfectly capable of building OpenGL programs as-is and without any further config needed, so you need to look in your own setup for the cause of this problem.

    Regarding not using the IDE, you're missing out on the best debugging tools available to mankind at the moment, so that's a very poor choice, but it's your choice so I'll drop it there.

  9. #9
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    10
    Quote Originally Posted by mhagain View Post
    glu32.lib does exist in "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" unless you've messed up the installation somehow. But for gluOrtho2D, there is actually no need whatsoever to use that function - you can just use glOrtho instead and get the same result.

    Despite all of this, a standard installation of the MS development tools is perfectly capable of building OpenGL programs as-is and without any further config needed, so you need to look in your own setup for the cause of this problem.

    Regarding not using the IDE, you're missing out on the best debugging tools available to mankind at the moment, so that's a very poor choice, but it's your choice so I'll drop it there.
    The GLU32.lib does exist inside the folder that you said, which is also the folder I'm specifying as a link path dir. I'm aware that MS comes with OpenGL version 1.1 (or some low version) pre-packaged. Though as far as I understand it, I should be getting the latest versions with my graphics card drivers, in this case, Nvidia drivers. I acquired GLUT from their website, the latest non-beta (3.6). I wanted to use the most up-to-date OpenGL versions as well.

    Switching to glOrtho fixed things in that I was able to compile and my program works fine, but I'm still curious for future reference as to:
    A) Where I can find the latest OpenGL/GLU libs, as I thought they were supposed to come in with the Nvidia SDK...and I can't find them.
    B) Why specifying the path to GLU32.lib and specifying it in the link path isn't working

    ---

    As for VS...yes, the debugger is nice, though IMO it ends there. The rest of the IDE is pretty crappy for what's supposed to be the creme de la creme of IDEs, IMHO, and is easily overtaken by most complete IDE's on the market (such as XCode or QT Creator). I'm writing a program on the GPU, Visual Studio does little (nothing) to help me there, nor can any other main IDE debugger. I rather write batch scripts or bash scripts because it makes things more portable. I don't like relying on a specific IDE to determine the compilation of my code, I rather it just work. I have the sad memories of working at a company who binded all their projects to VS, which was fine....until VS was updated and all of a sudden solutions didn't build right anymore and the software teams were in turmoil for a bit. It's not my cup of tea, I would rather use scripted compilation and developers can then use whatever editor floats their boat without relying on the development process I used.

    "The best debugging tools" - for desktop applications, which is where VS's debugger shines, I actually have to look towards GDB. GDB with a graphical front end (like what XCode uses for C/C++ debugging) is better than the VS C/C++ debugger, IMO.

    But yeah, that's all I'll say on the subject of IDE's as well, but point entail, the SW is being run on the GPU, this is just framework issues, so VS, nor any standard CPU application debugger can really help.

  10. #10
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    785
    You might want to look at freeglut (http://freeglut.sourceforge.net/) in the future. It is more up to date than glut and supports various IDE's. If you switch platforms a lot VS is a bit of a pain but if you are only on Windows there is not much point swimming against the stream.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •