[AD] Problem compiling Allegro with ACE networking library.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I'm building a multi-platform Allegro application that uses the ACE networking library. Everything works on Mac and Linux builds, however, Allegro and ACE libraries don't play nice together and won't compile properly on Windows. As a workaround, I build the Windows application using winsock but it would be nice if I didn't have this exception. I'm sending a similar bug report to the ACE developers and see if one or both parties can help figure out the problem.

The general problem is one of an order of include files. If you compile the code below as-is, you will get a bunch of errors complaining about macro and struct redefinitions such as the following (I've only included a sampling. There are a total of 71 of these errors): c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(467): warning C4005: 'SO_DONTLINGER' : macro redefinition c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(558): error C2011: 'sockaddr' : 'struct' type redefinition c:\ACE\ACE_wrappers\ace\OS_main.h(176): warning C4005: 'main' : macro redefinition

If you move the ace/Log_Msg.h header file to be compiled first, you get a single error: c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\allegro\system.h(31): fatal error C1001: INTERNAL COMPILER ERROR
       (compiler file 'msc1.cpp', line 2701)
        Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

If you try to put the allegro.h header first, then the ace/Log_msg.h and then the winalleg.h (or alternatively don't even include the winalleg.h header) you get the following errors with this program:

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinGDI.h(541): error C2371: 'BITMAP' : redefinition; different basic types c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinGDI.h(3587): error C2229: struct 'tagDIBSECTION' has an illegal zero-sized array c:\ACE\ACE_wrappers\ace\OS_main.h(176): warning C4005: 'main' : macro redefinition c:\Documents and Settings\Kirk\My Documents\Visual Studio Projects\AllegroAceTest\main.cpp(14): error C2065: '_mangled_main' : undeclared identifier


I've created a simple program to illustrate the problem.

#include <allegro.h>
#include <winalleg.h>
#include "ace/Log_Msg.h"
int main(int argc, char* argv[])
{
allegro_message("Allegro Message: Testing ACE and Allegro library integration" ); ACE_DEBUG((LM_DEBUG, "ACE_DEBUG: Testing ACE and Allegro Library integration\n" ));
}
END_OF_MAIN();

In order to attempt to build this simple application and see the errors reported, you first need to build the ACE networking library on a Windows machine. I currently am building this application and getting the errors with MSVC7 compiler.

1. Download ACE. http://deuce.doc.wustl.edu/ACE.zip.

2. Follow the build instructions for building ACE on Windows with MSVC++ http://www.cs.wustl.edu/~schmidt/ACE_wrappers/ACE-INSTALL.html#msvc

3. Create a simple MSVC7 project with one file and copy/paste the code in this post.

4. Set the project properties to be able to find the ACE include file and use the ACE dll for linking.

Thanks in advance!
Kirk Black






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/