i386-mingw32msvc-g++ -DHAVE_CONFIG_H -I. -I. -I. -Ilibmodplug -I/home/drfiemost/cross-libs/include -O2 -march=i586 -fomit-frame-pointer -fno-exceptions -Wall -ffast-math -D_REENTRANT -c
load_psm.cpp -o load_psm.o
/bin/sh ../libtool --tag=CXX --mode=compile
i386-mingw32msvc-g++ -DHAVE_CONFIG_H -I. -I. -I. -Ilibmodplug -I/home/drfiemost/cross-libs/include -O2 -march=i586 -fomit-frame-pointer -fno-exceptions -Wall -ffast-math -D_REENTRANT -c -o
load_abc.lo load_abc.cpp
i386-mingw32msvc-g++ -DHAVE_CONFIG_H -I. -I. -I. -Ilibmodplug -I/home/drfiemost/cross-libs/include -O2 -march=i586 -fomit-frame-pointer -fno-exceptions -Wall -ffast-math -D_REENTRANT -c
load_abc.cpp -o load_abc.o
load_abc.cpp: In function `ABCHANDLE* ABC_Init()':
load_abc.cpp:2341: error: `setenv' was not declared in this scope
load_abc.cpp:2341: warning: unused variable 'setenv'
load_abc.cpp:2345: error: `srandom' was not declared in this scope
load_abc.cpp:2346: error: `random' was not declared in this scope
load_abc.cpp:2353: error: `setenv' was not declared in this scope
load_abc.cpp:2345: warning: unused variable 'srandom'
load_abc.cpp:2346: warning: unused variable 'random'
load_abc.cpp:2353: warning: unused variable 'setenv'
load_abc.cpp: In member function `BOOL CSoundFile::ReadABC(const BYTE*,
DWORD)':
load_abc.cpp:3716: error: `uint' was not declared in this scope
load_abc.cpp:3716: error: expected `;' before "numpat"
load_abc.cpp:3719: error: expected `;' before "t"
load_abc.cpp:3753: error: `sleep' was not declared in this scope
load_abc.cpp:3753: warning: unused variable 'sleep'
load_abc.cpp:3928: error: `t' was not declared in this scope
load_abc.cpp:3957: error: `t' was not declared in this scope
load_abc.cpp:4027: error: `t' was not declared in this scope
load_abc.cpp:4046: error: `t' was not declared in this scope
load_abc.cpp:4085: error: `t' was not declared in this scope
load_abc.cpp:4147: error: `t' was not declared in this scope
load_abc.cpp:4183: error: `t' was not declared in this scope
load_abc.cpp:4257: error: `t' was not declared in this scope
load_abc.cpp:4288: error: `t' was not declared in this scope
load_abc.cpp:4560: error: `t' was not declared in this scope
load_abc.cpp:4936: error: `t' was not declared in this scope
load_abc.cpp:4973: error: `t' was not declared in this scope
load_abc.cpp:5019: error: `numpat' was not declared in this scope
load_abc.cpp:5026: error: `t' was not declared in this scope
load_abc.cpp:5026: error: expected `;' before "orderlen"
load_abc.cpp:5026: error: expected `)' before ';' token
load_abc.cpp:5026: error: expected `;' before ')' token
load_abc.cpp:5026: warning: statement with no effect
make[2]: *** [load_abc.lo] Error 1
Some of these have been fixed by converting uint->uint32_t.
The others seem to be caused by missing include files which are not required on windows.
Probably all of them should be possible to fix. Please checkout the CVS version (or I can email you a copy of the upcoming 0.8.5 release) and it should be much easier to cross compile.
Another option is to remove the ABC support while cross compiling.
Carlo Bramini posted a patch here: http://sourceforge.net/tracker/?func=detail&aid=2706241&group_id=1275&atid=301275
It doesn't apply cleanly to the 0.8.5 release due to the uint->uint32_t changes, maybe he could fix the issue.
Thank you,
Leandro
I noticed the patch part of sourceforge a bit late - will apply these fixes to CVS
There is still a problem because on MinGW you need to include stdint.h or int*_t types are not defined.
I fixed it with this patch:
diff -Naur libmodplug-0.8.5/src/libmodplug/stdafx.h libmodplug-0.8.5-mingw-fix/src/libmodplug/stdafx.h
--- libmodplug-0.8.5/src/libmodplug/stdafx.h 2009-04-14 15:01:11 +0000
+++ libmodplug-0.8.5-mingw-fix/src/libmodplug/stdafx.h 2009-04-14 15:02:01 +0000
@@ -9,6 +9,16 @@
#ifndef _STDAFX_H_
#define _STDAFX_H_
+#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED)
+# include "config.h"
+# define CONFIG_H_INCLUDED 1
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#ifdef _WIN32
@@ -32,16 +42,6 @@
#else
-#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED)
-# include "config.h"
-# define CONFIG_H_INCLUDED 1
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Regarding the use of stdint, it looks OK, however does this work in MSVC?
If it does, instead of duplicating the code twice, we probably should just remove that part of the code from the #ifdef and include it at the top.
Sorry - this is exactly what you have done.
I don't have MSVC so I can only test on MinGW; anyway I found another issue when UNICODE is defined:
g++ -DHAVE_CONFIG_H -I. -I../src/libmodplug -I/usr/local/include -O2 -march=i586 -pipe -DUNICODE -fno-exceptions -Wall -ffast-math -D_REENTRANT -MT sndmix.lo -MD -MP -MF .deps/sndmix.Tpo -c sndmix.cpp -DDLL_EXPORT -DPIC -o .libs/sndmix.o
In file included from sndmix.cpp:8:
./libmodplug/sndfile.h: In member function `void CSoundFile::GetTitle(CHAR*) const':
./libmodplug/sndfile.h:604: error: cannot convert `CHAR*' to `WCHAR*' for argument `1' to `WCHAR* lstrcpynW(WCHAR*, const WCHAR*, int)'
make[2]: *** [sndmix.lo] Error 1
Strange thing is that libmodplug-0.8 worked fine.
It seems "CHAR" has a special meaning inside windows.h - using 'char' instead of 'CHAR' means that this is more likely to happen. Does this happen in any other files?
Yes, it happens in every file where string functions are used (lstrcpy, lstrcpyn, strncmp, wsprintf)
When UNICODE is defined the wide char version of these functions, which works on WCHARs instead of CHARs, are called causing the errors.
Since strings in modules are always ANSI I think it can work by substituting functions as this:
lstrcpy -> memcpy
lstrcpyn -> memcpy
strncmp -> memcmp
wsprintf -> sprintf
I fixed the UNICODE issue by removing Windows specific types and substituting functions as follows:
lstrcpy -> strcpy
lstrcpyn -> strncpy
wsprintf -> sprintf
I'll upload the patch in the Patches section.