Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Compiling program with MinGW-2.0.0 + Allegro-4.1.1-static

This thread is locked; no one can reply to it. rss feed Print
Compiling program with MinGW-2.0.0 + Allegro-4.1.1-static
Daniel Schlyder
Member #257
April 2000
avatar

Having just upgraded MinGW to 2.0.0-2, I'm having problems compiling one of my games. The game compiled fine with static Allegro 4.1.1 when I used MinGW-1.1, but now it fails with the following output:

Quote:

E:\code\Wormlings>make
g++ -DVERSION_STR=\"2.0.1\" -DNDEBUG -DALLEGRO_STATICLINK -Wall -W -march=i586 -
O2 -funroll-loops -ffast-math -fomit-frame-pointer -c src/main.cpp -o obj/main.o

In file included from C:/mingw/include/windows.h:51,
from C:/mingw/include/c++/3.2/mingw32/bits/gthr-default.h:462,
from C:/mingw/include/c++/3.2/mingw32/bits/gthr.h:98,
from C:/mingw/include/c++/3.2/mingw32/bits/c++io.h:37,
from C:/mingw/include/c++/3.2/bits/fpos.h:44,
from C:/mingw/include/c++/3.2/bits/char_traits.h:46,
from C:/mingw/include/c++/3.2/string:47,
from src/graphics.h:21,
from src/main.cpp:16:
C:/mingw/include/winbase.h:931: declaration of C function `int
WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)' conflicts with
C:/mingw/include/allegro/platform/alwin.h:38: previous declaration `int
WinMain(void*, void*, char*, int)' here
In file included from C:/mingw/include/windows.h:53,
from C:/mingw/include/c++/3.2/mingw32/bits/gthr-default.h:462,
from C:/mingw/include/c++/3.2/mingw32/bits/gthr.h:98,
from C:/mingw/include/c++/3.2/mingw32/bits/c++io.h:37,
from C:/mingw/include/c++/3.2/bits/fpos.h:44,
from C:/mingw/include/c++/3.2/bits/char_traits.h:46,
from C:/mingw/include/c++/3.2/string:47,
from src/graphics.h:21,
from src/main.cpp:16:
C:/mingw/include/wingdi.h:1183: conflicting types for `typedef struct tagBITMAP

BITMAP'
C:/mingw/include/allegro/gfx.h:234: previous declaration as `typedef struct
BITMAP BITMAP'
src/main.cpp: In function `bool <unnamed>::init(bool)':
src/main.cpp:101: invalid conversion from `tagBITMAP*(*)(const char*, RGB*)' to

`BITMAP*(*)(const char*, RGB*)'
make: *** [obj/main.o] Error 1

Since I'm not using any Windows functions directly in my code (only including standard C++ headers), I thought including allegro.h would be enough. Even so, I tried adding winalleg.h after allegro.h, but I still get the errors.

All Allegro examples compile fine, but they're C, not C++, so maybe that's the problem?

I really have no idea what to do. Please help!

Bob
Free Market Evangelist
September 2000
avatar

I sent an email to the conductors list.
One of the errors is a redefinition of WinMain that happened in Mingw. This can easily be fixed.

What's surprising though is that <string> also includes <windows.h>! This of course messes up Allegro.

--
- Bob
[ -- All my signature links are 404 -- ]

Daniel Schlyder
Member #257
April 2000
avatar

I managed to compile the program by adding a file myallegro.h:

#ifndef MYALLEGRO_H
#define MYALLEGRO_H

#include <allegro.h>
#include <winalleg.h>

#endif // MYALLEGRO_H

and including this first in any file using Allegro. However, when I run the program it immediately crashes. I guess that could be unrelated, though.

[edit]The crash was caused by jpgalleg load_jpg()[/edit]

Go to: