473,604 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with compiler

Hello to all!

For a long time I have been "fighting" a problem compiling an OpenGL
program which uses GLUT. First I have put a question in a Watcom group
(I want to use this compiler) to which I got no reply, in an OpenGL
group somebody recommended me to use Visual C++ which I did. That worked
OK but I do would like to use Watcom.
In the meantime I found solutions to several of the errors I got but one
is left which I cannot find a solution to, my knowledge of C++-compilers
is just to limited. Any help would be very highly appreciated (and sorry
about the long message, I think it is better when one asks for help to
provide the people one is asking help of with all the information I
think is needed).

The problem is when compiling the following program with WPP386, the C++
version of Watcom. WCC386, the C version compiles OK.

My listing (from
http://www.trajectorylabs.com/gettin...gl_glut.html):

//---------------------------------------------------------------------
// Getting Started with OpenGL GLUT
// A Very Simple OpenGL Example
//
// Draws a simple window with a rectangle in it
//---------------------------------------------------------------------

/* #include <iostream.h*/
#include <stdlib.h>
#include <windows.h>
#include <Gl\gl.h>
#define GLUT_DISABLE_AT EXIT_HACK
#include <Gl\glut.h>

void init(void);
void display(void);

int main (int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplay Mode(GLUT_DOUBL E | GLUT_RGB);
glutInitWindowS ize(250, 250);
glutInitWindowP osition(100, 100);
glutCreateWindo w("My First OpenGL Application");
init();
glutDisplayFunc (display);
glutMainLoop();
return 0;
}

void init(void)
{
glClearColor(0. 0, 0.0, 0.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glMatrixMode(GL _PROJECTION);
glLoadIdentity( );
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}

void display(void)
{
glClear(GL_COLO R_BUFFER_BIT);
glRectf(-5.0, 5.0, 5.0, -5.0);
glutSwapBuffers ();
}

//---------------------------------------------------------------------

The line #define GLUT_DISABLE_AT EXIT_HACK I got from an explanation on
http://www.di.unipi.it/~nids/docs/watcom_glut_sdl.shtml.

Compiling it as a C++ program gives the following output from the compiler:

C:\WATCOM\Proje cts>wpp386 -5s pelles.cpp
Open Watcom C++32 Optimizing Compiler Version 1.6
Portions Copyright (c) 1989-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
C:\WATCOM\H\NT\ Gl\glut.h(146): Error! E867: col(38) conflict with a
previous using-decl 'exit'
C:\WATCOM\H\NT\ Gl\glut.h(146): Note! N393: col(38) included from
pelles.cpp(13)
C:\WATCOM\H\std lib.h(48): Note! N392: col(10) definition: 'void watcall
exit( int )'
pelles.cpp: 48 lines, included 46799, no warnings, 1 error

The problem is in glut.h which in its entirety can be found in the
following zip file http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip
but I will also paste the part of it in which according to the compiler
the problem occurs; there is an explanation about the "exit" thing in
this file, unfortunately my knowledge is too limited to be able to
deduct from it what I should do prevent the error from occuring.

This problem has been giving me quite a lot of headaches already (I am
not exagerating when saying that I spent at least 15 hours surfing the
web and googlegroups to find a solution, but I haven't found one... I am
already very happy that I can finally enjoy my recently bought OpenGL
book when using VC++ but as I want to get into Linux as well and
OpenWatcom is being made cross-platform I would prefer to use that, I
also like the IDE as it is quite simple (like me ;-)).

This is the part of glut.h in which the problem occurs (+ in the
beginning the explanation I mentioned), the line the compiler mentions
is put between "!'s":

/* Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).

One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.

Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_AT EXIT_HACK. */

/* XXX This is from Win32's <process.h*/
# if !defined(_MSC_V ER) && !defined(__cdec l)
/* Define __cdecl for non-Microsoft compilers. */
# define __cdecl
# define GLUT_DEFINED___ CDECL
# endif
# ifndef _CRTIMP
# ifdef _NTSDK
/* Definition compatible with NT SDK */
# define _CRTIMP
# else
/* Current definition */
# ifdef _DLL
# define _CRTIMP __declspec(dlli mport)
# else
# define _CRTIMP
# endif
# endif
# define GLUT_DEFINED__C RTIMP
# endif

/* GLUT API entry point declarations for Win32. */
# ifdef GLUT_BUILDING_L IB
# define GLUTAPI __declspec(dlle xport)
# else
# ifdef _DLL
# define GLUTAPI __declspec(dlli mport)
# else
# define GLUTAPI extern
# endif
# endif

/* GLUT callback calling convention for Win32. */
# define GLUTCALLBACK __cdecl

#endif /* _WIN32 */

#include <GL/gl.h>
#include <GL/glu.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_WIN32)
# ifndef GLUT_BUILDING_L IB
!!!!!!!!! extern _CRTIMP void __cdecl exit(int); !!!!!!!!!!!
# endif
#else
/* non-Win32 case. */
/* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
# define APIENTRY
# define GLUT_APIENTRY_D EFINED
# define CALLBACK
/* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
# define GLUTAPI extern
# define GLUTCALLBACK
/* Prototype exit for the non-Win32 case (see above). */
extern void exit(int);
#endif
Like I said, any help will be highly appreciated!

Yours sincerely,
Rene

P.S. Because of my job I do not have the opportunity to sit at my
computer very often and I can never predict when that will be, so if my
reply takes a while that is not because I am not interested.

P.P.S. Please forgive me language errors, English is not my mother tongue.
Jun 17 '07 #1
3 3437
Rene wrote:
For a long time I have been "fighting" a problem compiling an OpenGL
program which uses GLUT. First I have put a question in a Watcom group
(I want to use this compiler) to which I got no reply,
Why would you want to use a compiler that doesn't work and that nobody
supports? What's your motivation?
in an OpenGL
group somebody recommended me to use Visual C++ which I did. That
worked OK but I do would like to use Watcom.
WHY??
In the meantime I found solutions to several of the errors I got but
one is left which I cannot find a solution to, my knowledge of
C++-compilers is just to limited.
Our knowledge is limited as well. Watcom is very old, and their Open
Source version is flaky, and AFAICT, nobody seriously uses it for any
serious stuff, so I strongly recommend you to find a better compiler
for your project.
Any help would be very highly
appreciated (and sorry about the long message, I think it is better
when one asks for help to provide the people one is asking help of
with all the information I think is needed).

The problem is when compiling the following program with WPP386, the
C++ version of Watcom. WCC386, the C version compiles OK.
What you're asking is help with a particular compiler, which this NG
does not provide. This is a language newsgroup. We can [attempt to]
help you with _language_ problems, not with _compiler_ problems. The
latter kind is usually resolved in the areas where those compilers are
discussed, most *mainstream* compilers have their own forums, either
on Usenet, or on the Web, or elsewhere.

If you can't find any help in Watcom-specific forum, it means you are
most likely SOL. Change compilers.
[..problem description that involves compiler-specific stuff..]

This problem has been giving me quite a lot of headaches already (I am
not exagerating when saying that I spent at least 15 hours surfing the
web and googlegroups to find a solution, but I haven't found one... I
am already very happy that I can finally enjoy my recently bought
OpenGL book when using VC++ but as I want to get into Linux as well and
OpenWatcom is being made cross-platform I would prefer to use that, I
also like the IDE as it is quite simple (like me ;-)).
There is nothing this newsgroup can tell you. OpenWatcom is but
an implementation of the language (and I haven't heard many good things
about it, BTW). If it doesn't work for you and you can't solve it, use
either a different compiler (there are cross-platform compilers like
GNU) and a different IDE (you'll get used to any of them eventually, no
need to fixate on any single one), or use different ones on different
platforms. That's how we all do it.

Unless your boss (who pays you to do what he says) tells you to use
Watcom _and_ you cannot convince him that Watcom is not the right tool
for the job _AND_ if he insists, you cannot just pick up your stuff
and find another boss, you need to get on with the project by using
some other tools. Forget Watcom, take VC++ on Windows, G++ on Unix
(Linux), and don't look back. You've spent enough of your preciuos
energy on that nonsense already.
[..]

P.S. Because of my job I do not have the opportunity to sit at my
computer very often and I can never predict when that will be, so if
my reply takes a while that is not because I am not interested.
When you have time, you'll reply. When you reply, we'll see it.
Don't worry about it.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 18 '07 #2
Victor Bazarov schreef:
Rene wrote:
>For a long time I have been "fighting" a problem compiling an OpenGL
program which uses GLUT. First I have put a question in a Watcom group
(I want to use this compiler) to which I got no reply,

Why would you want to use a compiler that doesn't work and that nobody
supports? What's your motivation?
Hello Victor,

First of all, thank You very much for replying. My motivation is more or
less the fact that I heard good things about Watcom. The sources of
those good things may however not be that good; just things I read every
know and again on the web, couldn't give You a real pointer, I just
"absorbed" this info.
>in an OpenGL
group somebody recommended me to use Visual C++ which I did. That
worked OK but I do would like to use Watcom.

WHY??
>In the meantime I found solutions to several of the errors I got but
one is left which I cannot find a solution to, my knowledge of
C++-compilers is just to limited.

Our knowledge is limited as well. Watcom is very old, and their Open
Source version is flaky,
I did not know that.

and AFAICT, nobody seriously uses it for any
serious stuff, so I strongly recommend you to find a better compiler
for your project.
I think that as far as Windows 98 is concerned (my hobby room machine is
a bit limited for XP but 98SE runs like a rocket on it) I will stick
with Visual Studio 6.
>Any help would be very highly
appreciated (and sorry about the long message, I think it is better
when one asks for help to provide the people one is asking help of
with all the information I think is needed).

The problem is when compiling the following program with WPP386, the
C++ version of Watcom. WCC386, the C version compiles OK.

What you're asking is help with a particular compiler, which this NG
does not provide. This is a language newsgroup. We can [attempt to]
help you with _language_ problems, not with _compiler_ problems. The
latter kind is usually resolved in the areas where those compilers are
discussed, most *mainstream* compilers have their own forums, either
on Usenet, or on the Web, or elsewhere.
I had not realized that, I am sorry.
If you can't find any help in Watcom-specific forum, it means you are
most likely SOL. Change compilers.
I guess that would be the best solution.
>[..problem description that involves compiler-specific stuff..]

This problem has been giving me quite a lot of headaches already (I am
not exagerating when saying that I spent at least 15 hours surfing the
web and googlegroups to find a solution, but I haven't found one... I
am already very happy that I can finally enjoy my recently bought
OpenGL book when using VC++ but as I want to get into Linux as well and
OpenWatcom is being made cross-platform I would prefer to use that, I
also like the IDE as it is quite simple (like me ;-)).

There is nothing this newsgroup can tell you. OpenWatcom is but
an implementation of the language (and I haven't heard many good things
about it, BTW). If it doesn't work for you and you can't solve it, use
either a different compiler (there are cross-platform compilers like
GNU) and a different IDE (you'll get used to any of them eventually, no
need to fixate on any single one), or use different ones on different
platforms. That's how we all do it.

Unless your boss (who pays you to do what he says) tells you to use
Watcom _and_ you cannot convince him that Watcom is not the right tool
for the job _AND_ if he insists, you cannot just pick up your stuff
and find another boss, you need to get on with the project by using
some other tools.
As my OpenGL programming is limited to experimenting a little as a
hobby, there is no boss whose opinion I have to care about ;-).
Forget Watcom, take VC++ on Windows, G++ on Unix
(Linux), and don't look back. You've spent enough of your preciuos
energy on that nonsense already.
That is the problem with stubborn people like me. I think in this case
persisting would not really be stubborn any more, but more like stupid.
Indeed I would better use my time enjoying the OpenGL experiments and
trying to make some nice pictures instead of torturing my brain with a
problem that may not have a solution anyway.
>P.S. Because of my job I do not have the opportunity to sit at my
computer very often and I can never predict when that will be, so if
my reply takes a while that is not because I am not interested.

When you have time, you'll reply. When you reply, we'll see it.
Don't worry about it.
That is very kind of You!

Well, thanks again for Your reply. Being stubborn as I am, I must admit
that You're point of view shows more common sense than my
not-being-able-to-admit-defeat does ;-). I will take Your advice.

Yours sincerely,
Rene
Jun 24 '07 #3

Rene <in*****@invali d.comwrote in message...
Victor Bazarov schreef:
If you can't find any help in Watcom-specific forum, it means you are
most likely SOL. Change compilers.

I guess that would be the best solution.
As stated, VS6 was buggy and old (pre-standard).
Try GCC(MinGW). The easiest way to get it installed is to download and
install 'Dev-C++' IDE ( with the MinGW package).

Dev-C++ IDE: http://www.bloodshed.net/ (no $s)

You won't hurt anything ( just answer 'no' when asked about file
associations during install( can also be turned on-off in the 'tools' menu),
unless you want it that way). Don't remove any of your other compilers
unless you are really cramped for space on the HardDrive. If you don't like
it, just 'un-install' it (, no garbage left over, like some).

I run win98se on my 'windows' partition, so I know Dev-C++(MinGW) works.
--
Bob R
POVrookie
Jun 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3134
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This design pattern is very similar to the design pattern applied by the Assembly class. The twist is...
6
2031
by: Nafai | last post by:
Hello. I want to do something like this: class A { // It's virtual protected: float* data; int n; public: A(int a); virtual float* createData(); //...
6
2312
by: Alex | last post by:
I've a problem with following simple code (not really usefull): //--------------------------------------------------------------------------- #pragma hdrstop #include "stdio.h" #include <iostream> enum eTest1{et1_1, et1_2} e1; enum eTest2{et2_1, et2_2} e2; class ImageBase {
5
3317
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;
102
5640
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler can't tell where a bracket is missing.... a few weeks have past, I requested a feature for the delphi ide/editor "automatic identation of code in begin/end statements etc" and today when I woke up I suddenly released a very simple solution for this...
39
19601
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1) What's the difference between these 3 statements: (i) memcpy(&b, &KoefD, n); // this works somewhere in my code
5
2219
by: Tio | last post by:
I have project in MFC(vc++) . There are files and classes: classes:dialog1,dialog2,aaa,bbb ---------------------- main.cpp --------------------- #include "mainfrm.h" #include "dialog1.h" #include "dialog2.h"
16
3841
by: =?iso-8859-1?q?|-|e|=5F|=5F_B0=DD?= | last post by:
hi all! I got a problem. I declared a SOCKET var in my C program but when i compiled the program it displayed like *--------------------------------------------------------------* *'SOCKET': illegal use of this type as an expression * * C:\..\..\..\include\winsock2.h: see declaration of 'SOCKET' * *--------------------------------------------------------------* What i wrote in my program is like this..:
1
2080
by: prasath03 | last post by:
Hi, I am struggling with the following problem. Can somebody pls help me?. I am developing a wesbite for user can edit their files only, so i am going to develop a page for a Tree Structure in jsp. I got one java code from internet, that working perfectly in java, it doesn't work after i converted in jsp. I don't know what is the problem in that code. If anybody knows the answer let me know.... When i run that code from jsp it throws the...
0
7999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7931
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8423
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8411
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8281
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3956
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2437
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.