Results 1 to 7 of 7

Thread: Compiling glut programs with Borland C++

  1. #1
    Member Newbie
    Join Date
    Aug 2000
    Posts
    32

    Compiling glut programs with Borland C++

    When including glut.h and C++ iostream header, I get the following error:

    Error E2337 ...\Include\stdlib.h 584: Only one of a set of overloaded functions can be "C"

    Including the old C iostream.h produces the same error.

    I appreciate all comments and suggestions.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    352

    Re: Compiling glut programs with Borland C++

    well if you only meet problems with the .h files, feel happy... because i've used BC++ 5.0 for a long time and i've often met problems when linking with the gl libraries. And even when i got an exe file, i got runtime "unhandeld exceptions : access violation : FILENAME.DLL".

    And to answer to your question, i've looked at line 584 in bc++5.0 's stdlib.h. It is the end of the definition of the "max" template. Is it the same with your stdlib.h ? If yes, here's my idea for you : I guess that glut.h attempts to define its own "max". What you could try is to delete those few lines in stdlib.h concerning "max", and save the result into "mystdlib.h" in bc++'s include directory. Then just include <mystdlib.h> instead of <stdlib.h> in your program.
    I hope that all this will work...


    [This message has been edited by Morglum (edited 07-28-2001).]

  3. #3
    Member Newbie
    Join Date
    Aug 2000
    Posts
    32

    Re: Compiling glut programs with Borland C++

    The line 584 in the stdlib.h contains only this:

    using std::exit;

    Here is something that I have found in glut.h.

    /* Win32 has an annoying issue where there are multiple C run-time
    libraries (CRTs). If the executable is linked with a different CRT
    from the GLUT DLL, the GLUT DLL will not share the same CRT static
    data seen by the executable. In particular, atexit callbacks registered
    in the executable will not be called if GLUT calls its (different)
    exit routine). GLUT is typically built with the
    "/MD" option (the CRT with multithreading DLL support), but the Visual
    C++ linker default is "/ML" (the single threaded CRT).

    One workaround to this issue is requiring users to always link with
    the same CRT as GLUT is compiled with. That requires users supply a
    non-standard option. GLUT 3.7 has its own built-in workaround where
    the executable's "exit" function pointer is covertly passed to GLUT.
    GLUT then calls the executable's exit function pointer to ensure that
    any "atexit" calls registered by the application are called if GLUT
    needs to exit.

    Note that the __glut*WithExit routines should NEVER be called directly.
    To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */

    I am not familiar with Win32 programming, and researching this topic will be next on my "To Do" list. But for now I just want to compile my programs. If anyone knows what's going on, please reply. Thanks in advance.

  4. #4
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Compiling glut programs with Borland C++

    Hey Aster. I used to work with Borland C++ 4, and I had the same issues when using glut. The sollution to my problems was using the makelib utility that ships with BC++. It takes a parameter which is the Glut dll. Can't remember if it takes more. Anyway, it produces a new lib file, that you should use instead of the normal glut lib. This solved all my problems, dunno if it'll do the same for you. But anyway..

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    352

    Re: Compiling glut programs with Borland C++

    whoops. We don't have the same stdlib.h ... sorry.

  6. #6
    Member Newbie
    Join Date
    Aug 2000
    Posts
    32

    Re: Compiling glut programs with Borland C++

    Hey RedZen!

    The error I am talking about shows up with the new glut32.lib after using Borland implib utility. When including just glut.h, without stdlib.h, everything is fine.

    [This message has been edited by Aster (edited 07-30-2001).]

  7. #7
    Member Newbie
    Join Date
    Aug 2000
    Posts
    32

    Re: Compiling glut programs with Borland C++

    I found the solution to the problem: downloaded precompiled borland glut libraries from
    http://sites.netscape.net/ptrpck/borland.htm

Similar Threads

  1. GLUT compiling error on Borland C++ 5.02
    By ro in forum OpenGL: General
    Replies: 2
    Last Post: 10-08-2003, 09:28 AM
  2. GLUT compiling error on Borland C++ 5.02
    By ro in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-17-2003, 12:21 AM
  3. GLUT compiling error on Borland c++ 5.02
    By ro in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-16-2003, 12:30 PM
  4. Problems compiling programs including glut.h VC++.NET
    By ghost2112 in forum OpenGL: General
    Replies: 0
    Last Post: 05-24-2002, 05:03 PM
  5. Compiling programs with OpenGL & GLUT with VC++6
    By Lucho in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-14-2002, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean