Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Borland error E2337 when compiling a program that uses Glut

Posted on 2003-11-13
5
Medium Priority
?
707 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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 …
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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