Compilling allegro.h & windows.h

P

pkochanek

Hi,

my program is using both allegro.h and windows.h, but during compilling
it i'm getting a lot of errors like "conflicts with previous
declaration typedef struct BITMAP BITMAP". Problem is only with BITMAP
type... Have can i compile this??

Greets,
peter_k
 
B

Ben Pope

Hi,

my program is using both allegro.h and windows.h, but during compilling
it i'm getting a lot of errors like "conflicts with previous
declaration typedef struct BITMAP BITMAP". Problem is only with BITMAP
type... Have can i compile this??

I don't know what allegro.h is, and what windows.h is.

Perhaps you should ask on a newsgroup where these files are topical.

Ben Pope
 
R

Roland Pibinger

I don't know what allegro.h is, and what windows.h is.
Perhaps you should ask on a newsgroup where these files are topical.

This is the expected (avoidance of an) answer in c.l.c++.
The question however is: How do you handle name conflicts between
libraries
- that have no namespace and
- for which you cannot alter the source code?

An interesting question, IMHO.

Best wishes,
Roland Pibinger
 
B

Ben Pope

Roland said:
This is the expected (avoidance of an) answer in c.l.c++.

It's not avoidance. Either the entire code (including headers) should
be posted (which may or may not be appropriate), a snipped down version
(again, probably not appropriate) or it should be posted where those
files are topical.
The question however is: How do you handle name conflicts between
libraries
- that have no namespace and
- for which you cannot alter the source code?

An interesting question, IMHO.

Interesting it might be.

However, I can only assume that windows.h is the windows.h that I know,
although it hasn't been specified as such, it *could* be user defined.

I really have absolutely have no idea what allegro.h is, again, there
may be a file in the Windows API that has the same name, or it might be
part of another API.

Either way, these are both files which are platform/compiler/library
specific. If they have been used together before, then I would go to a
place where people who use the API more often, they are more likely to
know the answer to the name clash.

Back to the new topic you created, perhaps:
namespace allegro {
# include "allegro.h"
}

Would do it, that's pure speculation and if the library doesn't include
namespaces, then I very much doubt that identifiers are qualified to an
extent where that would come close to working.

Maybe some preprocessor trickery, include file, undo trickery. I don;t
know what the problems are.

Ben Pope
 
B

BobR

Ben Pope wrote in message said:
I really have absolutely have no idea what allegro.h is, ....

FYI:

Allegro is a cross-platform library intended for use in computer games
and other types of multimedia programming. It was initially conceived on
the Atari ST, but that platform sadly died during childbirth. After a
brief stay with Borland C, it was adopted by the fantastic djgpp
compiler, where it grew to maturity. In the fullness of time it gave
birth to children of its own, who went to live in such exotic locations
as DirectX and the X Server, but the entire family is now back together
again, living in harmony as a single portable entity. How about that for
a mixture of metaphors? :)

A wide range of extension packages and add-on modules are also available,
which can be found in the "Library Extensions" section of the Allegro
website, http://www.talula.demon.co.uk/allegro/.
[note: this is from a 2001 doc, so, Google if this link is not invalid.]


Another library of the same type is "Crystal Space". These have been around
for over 6 years minimum [before 1996 for Allegro].

You do not have to write a game to find these libraries useful!

[ note: Do NOT ask questions about these libraries in this NG. Go to one of
the games NGs, or a link on their sites. ]
 
B

Ben Pope

BobR said:
FYI:

Allegro is a cross-platform library intended for use in computer games
and other types of multimedia programming. It was initially conceived on
the Atari ST, but that platform sadly died during childbirth. After a

Oooh, now I feel nostalgic. My first computer. I started programming
with it when I copied the BBC micro worm game with STOS 15 years ago.

Ben Pope
 
B

BobR

(e-mail address removed) wrote in message
Hi,
my program is using both allegro.h and windows.h, but during compilling
it i'm getting a lot of errors like "conflicts with previous
declaration typedef struct BITMAP BITMAP". Problem is only with BITMAP
type... Have can i compile this??
Greets,
peter_k

AHAH! Found it!

For windows, you need to include "winalleg.h" right after "allegro.h". That
re-defs the struct BITMAP, then #undefs it (huh?).
Look through that header, there is a conditional to include "windows.h".

Anyway, try that and see what you get. And read the Allegro "readme.xxx" for
your compiler.

Further discussion about Allegro is discouraged since it is OT in this NG.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top