From: <no...@so...> - 2002-09-23 14:37:20
|
Bugs item #612932, was opened at 2002-09-23 04:04 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=612932&group_id=2435 Category: None Group: None Status: Closed Resolution: Fixed Priority: 5 Submitted By: Robert J Ohannessian (joe_programmer) Assigned to: Luke Dunstan (infidel) Summary: <string.h> should not include <windows.h> Initial Comment: This is causing problems with Allegro, as Allegro defines BITMAP and RGB as base types, which windows.h also defines. Normally, if you need to #include "windows.h", you need to include "winalleg.h" instead, which includes windows.h itself and contains workarounds for this issue. However, we can't force users to #include "winalleg.h", as it would result in code that would only compile on Windows. Is there a good reason for <string.h> to include <windows.h>? ---------------------------------------------------------------------- >Comment By: Luke Dunstan (infidel) Date: 2002-09-23 22:37 Message: Logged In: YES user_id=30442 Yes, you will still have thread safety with the #define, because it actually does use proxy functions which are defined in new versions of mingw-runtime (which is automatically linked, and distributed in Mingw-2.0.0). ---------------------------------------------------------------------- Comment By: Robert J Ohannessian (joe_programmer) Date: 2002-09-23 22:08 Message: Logged In: YES user_id=41801 If I use that #define you mentioned, will thread safety still be there? What about using a proxy for the thread safety-ness, instead of calling the Win32 functions directly? This would require linking to an additional file though. ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2002-09-23 11:13 Message: Logged In: YES user_id=30442 Thanks, I have now closed this bug. FYI, the C++ standard library needs to use some Win32 API functions for thread safety (see include/c++/3.2/mingw32/bits/gthr-default.h). ---------------------------------------------------------------------- Comment By: Robert J Ohannessian (joe_programmer) Date: 2002-09-23 11:03 Message: Logged In: YES user_id=41801 It works for me. I really don't like this workaround though. I hope this will become the default. Do you know what the reason for including windows.h is? ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2002-09-23 10:54 Message: Logged In: YES user_id=30442 You can prevent the C++ headers from including windows.h by defining __GTHREAD_HIDE_WIN32API on the compiler command line or in your source code. In future versions of Mingw GCC this will probably become the default. I have tested compiling your program like this: g++ test.cpp -D__GTHREAD_HIDE_WIN32API -lalleg ...and it works. Does this work for you? ---------------------------------------------------------------------- Comment By: Robert J Ohannessian (joe_programmer) Date: 2002-09-23 10:39 Message: Logged In: YES user_id=41801 I'm sorry, I didn't have time to submit a complete bug report. Well, here it is: The issue is not with Allegro or it's examples, as Allegro is a completely C (and asm) library. The problem is from using Allegro in conjuction with C++. The issue with WinMain() at the end of the error log can be ignored as it has been fixed in Allegro. Version: ======= - Allegro 4.1.2 - Mingw 2.0.0 self-installer - GCC 3.2 D:\PROGRA~1\MinGW\allegro>gcc -v Reading specs from D:/Programming/Mingw/Bin/../lib/gcc- lib/mingw32/3.2/specs Configured with: ../gcc/configure --with-gcc -- with-gnu-ld --with-gnu-as --host= mingw32 --target=mingw32 -- prefix=/mingw --enable-threads --disable-nls --enable - languages=f77,c++,objc,ada --disable-win32-registry --disable- shared Thread model: win32 gcc version 3.2 (mingw special 20020817-1) Test program: ========== [cut test.cpp] #include <string> #include <allegro.h> #include <stdio.h> int main() { allegro_init(); printf("Test\n"); return 0; } END_OF_MAIN(); [/cut] Error log: ======== D:\PROGRA~1\MinGW\allegro>g++ test.cpp -o test.exe -lalleg In file included from D:/Programming/Mingw/include/allegro.h:29, from test.cpp:3: D:/Programming/Mingw/include/allegro/system.h:29: conflicting types for `struct BITMAP' D:/Programming/Mingw/include/wingdi.h:1183: previous declaration as `typedef struct tagBITMAP BITMAP' D:/Programming/Mingw/include/allegro/system.h:108: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:109: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:110: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:110: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:111: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:111: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/system.h:112: using typedef-name `BITMAP' after `struct' In file included from D:/Programming/Mingw/include/allegro.h:34, from test.cpp:3: D:/Programming/Mingw/include/allegro/mouse.h:60: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/mouse.h:83: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/mouse.h:91: using typedef-name `BITMAP' after `struct' In file included from D:/Programming/Mingw/include/allegro.h:40, from test.cpp:3: D:/Programming/Mingw/include/allegro/gfx.h:57: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:58: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:65: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:66: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:67: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:68: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:69: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:70: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:71: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:72: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:135: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:136: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:137: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:138: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:138: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:139: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:139: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:140: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:141: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:142: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:143: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:144: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:145: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:146: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:147: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:148: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:148: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:149: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:149: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:150: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:150: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:151: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:151: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:152: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:152: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:153: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:153: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:154: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:154: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:155: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:155: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:156: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:157: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:158: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:159: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:160: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:160: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:161: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:162: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:162: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:163: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:163: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:164: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:164: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:165: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:165: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:166: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:166: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:167: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:167: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:168: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:168: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:169: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:169: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:170: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:170: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:171: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:172: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:172: using typedef-name `BITMAP' after `struct' D:/Programming/Mingw/include/allegro/gfx.h:234: conflicting types for `typedef struct BITMAP BITMAP' D:/Programming/Mingw/include/wingdi.h:1183: previous declaration as `typedef struct tagBITMAP BITMAP' In file included from D:/Programming/Mingw/include/allegro/gfx.h:384, from D:/Programming/Mingw/include/allegro.h:40, from test.cpp:3: D:/Programming/Mingw/include/allegro/inline/gfx.inl: In function `void clear_to_color(BITMAP*, int)': D:/Programming/Mingw/include/allegro/inline/gfx.inl:93: cannot convert `BITMAP* ' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/gfx.inl: In function `void acquire_bitmap(BITMAP*)': D:/Programming/Mingw/include/allegro/inline/gfx.inl:202: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/gfx.inl: In function `void release_bitmap(BITMAP*)': D:/Programming/Mingw/include/allegro/inline/gfx.inl:211: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing In file included from D:/Programming/Mingw/include/allegro/draw.h:62, from D:/Programming/Mingw/include/allegro.h:42, from test.cpp:3: D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `int getpixel(BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:35: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void putpixel(BITMAP*, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:43: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void vline(BITMAP*, int, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:51: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void hline(BITMAP*, int, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:59: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void line(BITMAP*, int, int, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:67: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void rectfill(BITMAP*, int, int, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:75: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_sprite(BITMAP*, BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:90: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl:90: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_sprite_v_flip(BITMAP*, BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:99: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_sprite_h_flip(BITMAP*, BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:108: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_sprite_vh_flip(BITMAP*, BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:118: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_trans_sprite(BITMAP*, BITMAP*, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:136: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl:136: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_lit_sprite(BITMAP*, BITMAP*, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:146: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void draw_character(BITMAP*, BITMAP*, int, int, int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:156: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void rotate_sprite(BITMAP*, BITMAP*, int, int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:168: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void rotate_sprite_v_flip(BITMAP*, BITMAP*, int, int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:180: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void rotate_scaled_sprite(BITMAP*, BITMAP*, int, int, long int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:192: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void rotate_scaled_sprite_v_flip(BITMAP*, BITMAP*, int, int, long int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:204: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void pivot_sprite(BITMAP*, BITMAP*, int, int, int, int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:213: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void pivot_sprite_v_flip(BITMAP*, BITMAP*, int, int, int, int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:222: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void pivot_scaled_sprite(BITMAP*, BITMAP*, int, int, int, int, long int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:231: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/draw.inl: In function `void pivot_scaled_sprite_v_flip(BITMAP*, BITMAP*, int, int, int, int, long int, long int)': D:/Programming/Mingw/include/allegro/inline/draw.inl:240: cannot convert ` BITMAP*' to `tagBITMAP*' in argument passing In file included from D:/Programming/Mingw/include/allegro/rle.h:41, from D:/Programming/Mingw/include/allegro.h:43, from test.cpp:3: D:/Programming/Mingw/include/allegro/inline/rle.inl: In function `void draw_rle_sprite(BITMAP*, const RLE_SPRITE*, int, int)': D:/Programming/Mingw/include/allegro/inline/rle.inl:36: cannot convert `BITMAP* ' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/rle.inl: In function `void draw_trans_rle_sprite(BITMAP*, const RLE_SPRITE*, int, int)': D:/Programming/Mingw/include/allegro/inline/rle.inl:52: cannot convert `BITMAP* ' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/rle.inl:52: cannot convert `BITMAP* ' to `tagBITMAP*' in argument passing D:/Programming/Mingw/include/allegro/inline/rle.inl: In function `void draw_lit_rle_sprite(BITMAP*, const RLE_SPRITE*, int, int, int)': D:/Programming/Mingw/include/allegro/inline/rle.inl:62: cannot convert `BITMAP* ' to `tagBITMAP*' in argument passing test.cpp: At global scope: test.cpp:10: declaration of C function `int WinMain(void*, void*, char*, int)' conflicts with D:/Programming/Mingw/include/winbase.h:931: previous declaration `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)' here D:\PROGRA~1\MinGW\allegro> Thank you. ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2002-09-23 10:15 Message: Logged In: YES user_id=30442 What versions of Allegro, GCC, w32api and mingw-runtime are you using? string.h does not include windows.h, so it must be some other header (e.g. the C++ standard library). I just built Allegro 4.1.2 with the latest Mingw packages and it worked perfectly, including the example and test programs. Please supply a test case that demonstrates the problem. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=612932&group_id=2435 |