?
Solved

Borland error E2337 when compiling a program that uses Glut

Posted on 2003-11-13
5
Medium Priority
?
706 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 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