Solved

Borland error E2337 when compiling a program that uses Glut

Posted on 2003-11-13
5
699 Views
Last Modified: 2013-12-26
I have a project at school to do. However, I am unable to get past an error that Borland is throwing when I try to compile some C source code. We have to use Glut in order to create the simple program. The error is as follows:

Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
main.c:
Error E2337 c:\Borland\Bcc55\include\glut\glut.h 146: Only one of a set of overloaded functions can be "C"

I have noticed that another user of this forum had attempted to get some assistance with this problem, but the information provided is either non-existant now or not working.

I would appreciate anyones response on this problem.

OS: Windows XP

Thank you,
0
Comment
Question by:cbriarnold
  • 2
5 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 9753020
This looks like a problem of name conflict .... you are having some overloaded function which you are trying to compile as C program and C does not support overloading ...

The compiler encodes C++ function names to allow overloading. To call a C function or a C++ function "masquerading" as a C function, you must prevent this encoding. Do so by using the extern "C" declaration. For example:

 extern "C" {

double sqrt(double); //sqrt(double) has C linkage

    }


This linkage specification does not affect the semantics of the program using sqrt(), but simply causes the compiler to use the C naming conventions for sqrt().

Only one of a set of overloaded C++ functions can have C linkage. You can use C linkage for C++ functions that you intend to call from a C program, but you would only be able to use one instance of that function.

You cannot specify C linkage inside a function definition. Such declarations can only be done at the global scope
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10127248
#9753020
0
 

Expert Comment

by:mdavidn
ID: 10502874
I had this problem as well. You can fix it with this:

#include <gl/glut.h>
#include <gl/gl.h>

DO NOT include <windows.h>. gl/glut.h includes all the declarations from windows.h that gl/gl.h needs. Because of this, gl/glut.h must be inlcuded before gl/gl.h.

Matthew
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now