Thread: Compiled GLOW into static lib

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005

    Compiled GLOW into static lib

    I wasn't sure where to put this - it's Visual Studio 2003 / OpenGL / GLOW specific so I guess it's up to the mods where to put it.

    I started following the tutorial on GLOW and was reading about compiling it to a static library instead of using it as a source code distro and was having a problem getting it to compile.


    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdlib.h(256) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
            c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\gl\glut.h(152) : see declaration of 'exit'
    Now I just thought I'd post this up incase anybody else had troubles with this. It wasn't the hardest thing to solve (just had to add a precompiler directive in glut.h) but there's always somebody out there who'll have a problem with it.

    Since I can't be bothered to upload my glut.h and link to it, here's what you need to add. Go to (Ctrl+G in VS 2003) line 145 of glut.h:

    #if defined(_WIN32)
    # ifndef GLUT_BUILDING_LIB
    extern _CRTIMP void __cdecl exit(int);
    #  endif
    # endif

    #if defined(_WIN32)
    # ifndef GLUT_BUILDING_LIB
    extern _CRTIMP __declspec (noreturn) void __cdecl exit(int);
    #  else
    extern _CRTIMP void __cdecl exit(int);
    #  endif
    # endif
    Then just define GLOW_COMPAT_MSVCEXITHACK and it builds fine. I do it in my project properties->C/C++->Preprocessor->Preprocessor definitions field.

    Just thought somebody might want to know. I'm going to see what this GLOW can do now, ciao!

    EDIT: Grr, I thought I'd try and compile a Release version but it's having some link problems. Actually I'd say it's the link problem:

    error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
    I haven't got the brain energy to try and get this working. I'm gonna have a shower and hit the hay. 'Night.
    Last edited by cboard_member; 03-05-2006 at 03:12 PM.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  5. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM