Solved

Borland error E2337 when compiling a program that uses Glut

Posted on 2003-11-13
5
703 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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