Solved

Borland error E2337 when compiling a program that uses Glut

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

896 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

14 Experts available now in Live!

Get 1:1 Help Now