Re: [AD] Conflict between Allegro and std string library |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Maestro:
> There is a conflict between Allegro (4.0) and "string" library.
> I tried to compile the following code under Dev-C++ 4.9.8.9:
It looks like "string" uses Win32 API. You can fix the conflicts by including
winalleg.h after allegro.h on Windows:
#include <allegro.h>
#ifdef _WIN32
# include <winalleg.h>
#endif
Or, if you don't plan to use Win32 API directly in your own code, defining
__GTHREAD_HIDE_WIN32API should also work.
The, unrelated, std::string conversion errors can be fixed by using
std::string::c_str(), like this:
textout(screen, font, String.c_str(),
(SCREEN_W - text_length(font, String.c_str())) >> 1,
text_height(font) + 2, 14);
Allegro is written in C (well, mostly anyway) and consequently doesn't support
C++ features like std::string.
Kind regards,
Daniel Schlyder
--
http://bitblaze.com/