Crosscompiling from Linux for Windows

Why not. At least it’s always fun to see how other people are mistreating their systems :slight_smile:

Infact I’m a sado masochistic :slight_smile:

Anyway, on Ubuntu 10.04 I’ve built a cross compiling toolchain mainly composed of:
[ul]GCC 4.5.0
SDL 1.2.14
BOOST 1.43.0
(something else)[/ul]
Then i made a SVN checkout (now at rev1741) and configured with

LIBS="-lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid -lpng -ltiff -ljpeg -lz" ./configure --host=i686-pc-mingw32 --with-boost=/opt/mingw/usr/i686-pc-mingw32

First make:

libtool: compile:  i686-pc-mingw32-g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.82\" "-DPACKAGE_STRING=\"vcmi 0.82\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.82\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" "-DHAVE_BOOST=/**/" "-DHAVE_BOOST_SYSTEM=/**/" "-DHAVE_BOOST_FILESYSTEM=/**/" "-DHAVE_BOOST_THREAD=/**/" "-DHAVE_BOOST_IOSTREAMS=/**/" -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I. -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/local/share/vcmi\" -DBIN_DIR=\"/usr/local/bin\" -DLIB_DIR=\"/usr/local/lib/vcmi\" -Wno-sign-compare -MT libvcmi_la-CConsoleHandler.lo -MD -MP -MF .deps/libvcmi_la-CConsoleHandler.Tpo -c ../CConsoleHandler.cpp  -DDLL_EXPORT -DPIC -o .libs/libvcmi_la-CConsoleHandler.o
i686-pc-mingw32-g++: unrecognized option '-pthread'
In file included from ../stdafx.h:21:0,
                 from ../CConsoleHandler.cpp:2:
../global.h:40:0: warning: "DATA_DIR" redefined
<command-line>:0:0: note: this is the location of the previous definition
../global.h:42:0: warning: "BIN_DIR" redefined
<command-line>:0:0: note: this is the location of the previous definition
../global.h:152:0: warning: "DLL_EXPORT" redefined
<command-line>:0:0: note: this is the location of the previous definition
../CConsoleHandler.cpp:31:22: fatal error: dbghelp.h: No such file or directory
compilation terminated.
make[1]: *** [libvcmi_la-CConsoleHandler.lo] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
make: *** [all-recursive] Errore 1

No problem, I copy dbghelp.h from latest Wine 1.2.0

Second make:

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi/lib»
/bin/sh ../libtool  --tag=CXX   --mode=compile i686-pc-mingw32-g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.82\" -DPACKAGE_STRING=\"vcmi\ 0.82\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.82\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I.   -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/local/share/vcmi\" -DBIN_DIR=\"/usr/local/bin\" -DLIB_DIR=\"/usr/local/lib/vcmi\" -Wno-sign-compare -MT libvcmi_la-HeroBonus.lo -MD -MP -MF .deps/libvcmi_la-HeroBonus.Tpo -c -o libvcmi_la-HeroBonus.lo `test -f 'HeroBonus.cpp' || echo './'`HeroBonus.cpp
libtool: compile:  i686-pc-mingw32-g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.82\" "-DPACKAGE_STRING=\"vcmi 0.82\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.82\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" "-DHAVE_BOOST=/**/" "-DHAVE_BOOST_SYSTEM=/**/" "-DHAVE_BOOST_FILESYSTEM=/**/" "-DHAVE_BOOST_THREAD=/**/" "-DHAVE_BOOST_IOSTREAMS=/**/" -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I. -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/local/share/vcmi\" -DBIN_DIR=\"/usr/local/bin\" -DLIB_DIR=\"/usr/local/lib/vcmi\" -Wno-sign-compare -MT libvcmi_la-HeroBonus.lo -MD -MP -MF .deps/libvcmi_la-HeroBonus.Tpo -c HeroBonus.cpp  -DDLL_EXPORT -DPIC -o .libs/libvcmi_la-HeroBonus.o
i686-pc-mingw32-g++: unrecognized option '-pthread'
In file included from HeroBonus.h:2:0,
                 from HeroBonus.cpp:2:
../global.h:40:0: warning: "DATA_DIR" redefined
<command-line>:0:0: note: this is the location of the previous definition
../global.h:42:0: warning: "BIN_DIR" redefined
<command-line>:0:0: note: this is the location of the previous definition
../global.h:152:0: warning: "DLL_EXPORT" redefined
<command-line>:0:0: note: this is the location of the previous definition
HeroBonus.cpp:16:46: error: external linkage required for symbol 'bonusNameMap' because of 'dllexport' attribute
HeroBonus.cpp: In member function 'Bonus* CBonusSystemNode::getBonus(const CSelector&)':
HeroBonus.cpp:167:33: warning: suggest parentheses around assignment used as truth value
make[1]: *** [libvcmi_la-HeroBonus.lo] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
make: *** [all-recursive] Errore 1

But now how can I try to fix it without the risk of breaking everything?

The DATA_DIR problem comes from 2 definitions: one on the command line and one in global.h. That could be fixed by adding a “&& !defined(_MIGWIN32)” or something like that in global.h.

DLL_EXPORT is defined as nothing on the command line and something else in global.h. I would add a “#undef DLL_EXPORT” right before the define and see if it works better.

Redifined warnings are gone but the main error is still with me…

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi/lib»
/bin/sh ../libtool  --tag=CXX   --mode=compile i686-pc-mingw32-g++ -DPACKAGE_NAME="vcmi" -DPACKAGE_TARNAME="vcmi" -DPACKAGE_VERSION="0.82" -DPACKAGE_STRING="vcmi\ 0.82" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="vcmi" -DVERSION="0.82" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=".libs/" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I.   -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -MT libvcmi_la-HeroBonus.lo -MD -MP -MF .deps/libvcmi_la-HeroBonus.Tpo -c -o libvcmi_la-HeroBonus.lo `test -f 'HeroBonus.cpp' || echo './'`HeroBonus.cpp
libtool: compile:  i686-pc-mingw32-g++ -DPACKAGE_NAME="vcmi" -DPACKAGE_TARNAME="vcmi" -DPACKAGE_VERSION="0.82" "-DPACKAGE_STRING="vcmi 0.82"" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="vcmi" -DVERSION="0.82" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=".libs/" "-DHAVE_BOOST=/**/" "-DHAVE_BOOST_SYSTEM=/**/" "-DHAVE_BOOST_FILESYSTEM=/**/" "-DHAVE_BOOST_THREAD=/**/" "-DHAVE_BOOST_IOSTREAMS=/**/" -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I. -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -MT libvcmi_la-HeroBonus.lo -MD -MP -MF .deps/libvcmi_la-HeroBonus.Tpo -c HeroBonus.cpp  -DDLL_EXPORT -DPIC -o .libs/libvcmi_la-HeroBonus.o
i686-pc-mingw32-g++: unrecognized option '-pthread'
HeroBonus.cpp:16:46: error: external linkage required for symbol 'bonusNameMap' because of 'dllexport' attribute
HeroBonus.cpp: In member function 'Bonus* CBonusSystemNode::getBonus(const CSelector&)':
HeroBonus.cpp:167:33: warning: suggest parentheses around assignment used as truth value
make[1]: *** [libvcmi_la-HeroBonus.lo] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
make: *** [all-recursive] Errore 1

Try removing the DLL_EXPORT in HeroBonus.cpp:16. It might conflict with the declaration in the header file.

If that doesn’t help, try removing const both from definition in HeroBonus.cpp:16 and declaration in HeroBonus.h.

Third make after last suggestions:

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi/lib»
make[1]: Non c'è da fare nulla per «all»
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
Making all in client
make[1]: ingresso nella directory «/opt/src/vcmi/client»
i686-pc-mingw32-g++ -DPACKAGE_NAME="vcmi" -DPACKAGE_TARNAME="vcmi" -DPACKAGE_VERSION="0.82" -DPACKAGE_STRING="vcmi\ 0.82" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="vcmi" -DVERSION="0.82" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=".libs/" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I.   -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main   -g -O2 -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -MT vcmiclient-CCallback.o -MD -MP -MF .deps/vcmiclient-CCallback.Tpo -c -o vcmiclient-CCallback.o `test -f '../CCallback.cpp' || echo './'`../CCallback.cpp
i686-pc-mingw32-g++: unrecognized option '-pthread'
In file included from /opt/mingw/usr/i686-pc-mingw32/include/SDL/SDL.h:30:0,
                 from ../client/SDL_framerate.h:20,
                 from ../client/CPlayerInterface.h:6,
                 from ../CCallback.cpp:5:
../CCallback.h:320:13: error: previous declaration of 'int SDL_main(int, char**)' with 'C++' linkage
/opt/mingw/usr/i686-pc-mingw32/include/SDL/SDL_main.h:57:53: error: conflicts with new declaration with 'C' linkage
make[1]: *** [vcmiclient-CCallback.o] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/client»
make: *** [all-recursive] Errore 1

So SDL_main.h tells me:

extern C_LINKAGE int SDL_main(int argc, char *argv]);

while CCallback.h :

friend int main(int argc, char** argv); 

Don’t flame, but I’ve changed

friend int main(int argc, char** argv); 

to

friend int main(int argc, char** argv]);

Fourth make:

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi/lib»
make[1]: Non c'è da fare nulla per «all»
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
Making all in client
make[1]: ingresso nella directory «/opt/src/vcmi/client»
i686-pc-mingw32-g++ -DPACKAGE_NAME="vcmi" -DPACKAGE_TARNAME="vcmi" -DPACKAGE_VERSION="0.82" -DPACKAGE_STRING="vcmi\ 0.82" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="vcmi" -DVERSION="0.82" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=".libs/" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SQRT=1 -I.   -pthread -I/opt/mingw/usr/i686-pc-mingw32/include -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main   -g -O2 -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -MT vcmiclient-CVideoHandler.o -MD -MP -MF .deps/vcmiclient-CVideoHandler.Tpo -c -o vcmiclient-CVideoHandler.o `test -f '../hch/CVideoHandler.cpp' || echo './'`../hch/CVideoHandler.cpp
i686-pc-mingw32-g++: unrecognized option '-pthread'
../hch/CVideoHandler.cpp: In member function 'virtual bool CBIKHandler::open(std::string)':
../hch/CVideoHandler.cpp:153:57: error: invalid conversion from 'int (*)()' to 'void*'
../hch/CVideoHandler.cpp:167:1: error: jump to label 'checkErrorAndClean'
../hch/CVideoHandler.cpp:150:8: error:   from here
../hch/CVideoHandler.cpp:153:8: error:   crosses initialization of 'void* waveout'
make[1]: *** [vcmiclient-CVideoHandler.o] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/client»
make: *** [all-recursive] Errore 1

Another compilation issue is blocking me but I’m stubborn!

If you put ] than you have to remove one of *. So either “char *argv" or "char argv]". That’s generally the same. But never "char argv]”.

Try adding C-style cast:

void *waveout = (void*)GetProcAddress(dll,"_BinkOpenWaveOut@4");

For the next error, split waveout declaration and initialization (that is declare it and then assign value, not initialize)

a) my gcc always output an error in each case… really but i’ll document myself about “*” and “]”

b) actually the only problem is about linking vcmiclient.exe…

I’ve attached the output and it seems that libvcmi.a is not considered while linking

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi/lib»
make[1]: Non c'è da fare nulla per «all»
make[1]: uscita dalla directory «/opt/src/vcmi/lib»
Making all in client
make[1]: ingresso nella directory «/opt/src/vcmi/client»
/bin/sh ../libtool --tag=CXX   --mode=link i686-pc-mingw32-g++ -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main   -g -O2 -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -L../lib  -o vcmiclient.exe vcmiclient-CCallback.o vcmiclient-CGameInterface.o vcmiclient-CThreadHelper.o vcmiclient-CDefHandler.o vcmiclient-CMusicHandler.o vcmiclient-CSndHandler.o vcmiclient-CVideoHandler.o vcmiclient-AdventureMapButton.o vcmiclient-CAdvmapInterface.o vcmiclient-CBattleInterface.o vcmiclient-CBitmapHandler.o vcmiclient-CCastleInterface.o vcmiclient-CConfigHandler.o vcmiclient-CCreatureAnimation.o vcmiclient-CCursorHandler.o vcmiclient-CGameInfo.o vcmiclient-CHeroWindow.o vcmiclient-CKingdomInterface.o vcmiclient-CMT.o vcmiclient-CMessage.o vcmiclient-CPlayerInterface.o vcmiclient-CPreGame.o vcmiclient-CSpellWindow.o vcmiclient-Client.o vcmiclient-GUIBase.o vcmiclient-GUIClasses.o vcmiclient-Graphics.o vcmiclient-NetPacksClient.o vcmiclient-SDL_Extensions.o vcmiclient-SDL_framerate.o vcmiclient-mapHandler.o ../lib/libvcmi.la -L/opt/mingw/usr/i686-pc-mingw32/lib -lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid -lSDL_ttf -lSDL_image -lSDL_mixer -lSDL -lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -liconv -lm -luser32 -lgdi32 -lws2_32 -lwinmm -ldxguid -lpng -ltiff -lz -ljpeg -lavformat -lswscale   -lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -liconv -lm -luser32 -lgdi32 -lws2_32 -lwinmm -ldxguid -lpng -ltiff -lz -ljpeg
libtool: link: i686-pc-mingw32-g++ -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -g -O2 -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -Wno-sign-compare -o vcmiclient.exe vcmiclient-CCallback.o vcmiclient-CGameInterface.o vcmiclient-CThreadHelper.o vcmiclient-CDefHandler.o vcmiclient-CMusicHandler.o vcmiclient-CSndHandler.o vcmiclient-CVideoHandler.o vcmiclient-AdventureMapButton.o vcmiclient-CAdvmapInterface.o vcmiclient-CBattleInterface.o vcmiclient-CBitmapHandler.o vcmiclient-CCastleInterface.o vcmiclient-CConfigHandler.o vcmiclient-CCreatureAnimation.o vcmiclient-CCursorHandler.o vcmiclient-CGameInfo.o vcmiclient-CHeroWindow.o vcmiclient-CKingdomInterface.o vcmiclient-CMT.o vcmiclient-CMessage.o vcmiclient-CPlayerInterface.o vcmiclient-CPreGame.o vcmiclient-CSpellWindow.o vcmiclient-Client.o vcmiclient-GUIBase.o vcmiclient-GUIClasses.o vcmiclient-Graphics.o vcmiclient-NetPacksClient.o vcmiclient-SDL_Extensions.o vcmiclient-SDL_framerate.o vcmiclient-mapHandler.o -mwindows -mwindows -mwindows  -L/opt/src/vcmi/lib ../lib/.libs/libvcmi.a -lboost_system-mt -lboost_filesystem-mt -lboost_thread_win32-mt -lboost_iostreams-mt -L/opt/mingw/usr/i686-pc-mingw32/lib /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_ttf.a /opt/mingw/usr/i686-pc-mingw32/lib/libfreetype.a /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_image.a /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_mixer.a /opt/mingw/usr/i686-pc-mingw32/lib/libmikmod.a -lpthread /opt/mingw/usr/i686-pc-mingw32/lib/libvorbisfile.a /opt/mingw/usr/i686-pc-mingw32/lib/libvorbis.a /opt/mingw/usr/i686-pc-mingw32/lib/libogg.a /opt/mingw/usr/i686-pc-mingw32/lib/libsmpeg.a -lstdc++ -lm /opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/libstdc++.a -lavformat -lswscale -lmingw32 -lSDLmain /opt/mingw/usr/i686-pc-mingw32/lib/libSDL.a /opt/mingw/usr/i686-pc-mingw32/lib/libiconv.a -luser32 -lgdi32 -lws2_32 -lwinmm -ldxguid /opt/mingw/usr/i686-pc-mingw32/lib/libpng14.a /opt/mingw/usr/i686-pc-mingw32/lib/libtiff.a -lz /opt/mingw/usr/i686-pc-mingw32/lib/libjpeg.a
/opt/mingw/usr/i686-pc-mingw32/lib/libmingw32.a(tlssup.o):tlssup.c:(.tls+0x0): multiple definition of `__tls_used'
/opt/mingw/usr/i686-pc-mingw32/lib/libboost_thread_win32-mt.a(tss_pe.o):tss_pe.cpp:(.rdata$T+0x0): first defined here
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:979: undefined reference to `__imp___ZN10CGameState9getPlayerEhb'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:969: undefined reference to `__imp___ZN10BattleInfo14hasWallPenaltyEii'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:964: undefined reference to `__imp___ZN10BattleInfo18hasDistancePenaltyEii'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:945: undefined reference to `__imp___ZN10BattleInfo8getStackEib'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:945: undefined reference to `__imp___ZNK16CBonusSystemNode7LuckValEv'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:940: undefined reference to `__imp___ZN10BattleInfo8getStackEib'
vcmiclient-CCallback.o:/opt/src/vcmi/client/../CCallback.cpp:940: undefined reference to `__imp___ZNK16CBonusSystemNode9MoraleValEv'

...

/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
vcmiclient-mapHandler.o: In function `_ZN7CLoggerlsEPFRSoS0_E':
/opt/src/vcmi/client/../global.h:331: undefined reference to `__imp__logfile'
vcmiclient-mapHandler.o: In function `operator<< <char [39]>':
/opt/src/vcmi/client/../global.h:339: undefined reference to `__imp__tlog1'
/opt/src/vcmi/client/../global.h:341: undefined reference to `__imp__console'
vcmiclient-mapHandler.o: In function `print<char [39]>':
/opt/src/vcmi/client/../CConsoleHandler.h:38: undefined reference to `__imp___ZN15CConsoleHandler8setColorEi'
/opt/src/vcmi/client/../CConsoleHandler.h:40: undefined reference to `__imp___ZN15CConsoleHandler8setColorEi'
vcmiclient-mapHandler.o: In function `flush<char, std::char_traits<char> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog1'
vcmiclient-mapHandler.o: In function `operator<< <char [39]>':
/opt/src/vcmi/client/../global.h:346: undefined reference to `__imp__logfile'
vcmiclient-mapHandler.o: In function `flush<char, std::char_traits<char> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog1'
vcmiclient-mapHandler.o: In function `operator<< <int>':
/opt/src/vcmi/client/../global.h:341: undefined reference to `__imp__console'
vcmiclient-mapHandler.o: In function `print<int>':
/opt/src/vcmi/client/../CConsoleHandler.h:38: undefined reference to `__imp___ZN15CConsoleHandler8setColorEi'
/opt/src/vcmi/client/../CConsoleHandler.h:40: undefined reference to `__imp___ZN15CConsoleHandler8setColorEi'
vcmiclient-mapHandler.o: In function `flush<char, std::char_traits<char> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog1'
vcmiclient-mapHandler.o: In function `operator<< <int>':
/opt/src/vcmi/client/../global.h:346: undefined reference to `__imp__logfile'
vcmiclient-mapHandler.o: In function `flush<char, std::char_traits<char> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog1'
vcmiclient-mapHandler.o: In function `_ZN7CLoggerlsEPFRSoS0_E':
/opt/src/vcmi/client/../global.h:331: undefined reference to `__imp__logfile'
vcmiclient-mapHandler.o: In function `flush<char, std::char_traits<char> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog1'
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/include/c++/ostream:563: undefined reference to `__imp__tlog0'
vcmiclient-mapHandler.o: In function `_ZN7OCM_HLPclERKSt4pairIPK16CGObjectInstance8SDL_RectES7_':
/opt/src/vcmi/client/mapHandler.cpp:83: undefined reference to `__imp___ZNK16CGObjectInstanceltERKS_'
/opt/src/vcmi/client/mapHandler.cpp:83: undefined reference to `__imp___ZNK16CGObjectInstanceltERKS_'
/opt/src/vcmi/client/mapHandler.cpp:83: undefined reference to `__imp___ZNK16CGObjectInstanceltERKS_'
/opt/src/vcmi/client/mapHandler.cpp:83: undefined reference to `__imp___ZNK16CGObjectInstanceltERKS_'
/opt/src/vcmi/client/mapHandler.cpp:83: undefined reference to `__imp___ZNK16CGObjectInstanceltERKS_'
vcmiclient-mapHandler.o:/opt/src/vcmi/client/mapHandler.cpp:83: more undefined references to `__imp___ZNK16CGObjectInstanceltERKS_' follow
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o): In function `_Z20onUnhandledExceptionP19_EXCEPTION_POINTERS@4':
/opt/src/vcmi/lib/../CConsoleHandler.cpp:138: undefined reference to `_MiniDumpWriteDump@28'
collect2: ld returned 1 exit status
make[1]: *** [vcmiclient.exe] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi/client»
make: *** [all-recursive] Errore 1

Bye (for the moment),
Marco

I really can’t pass this no-linking problem… maybe I’ll attempt to recompile my toolchain, see you later and thanks for patience!

There’s an explanation here for the first error: groups.google.com/group/boost-li … 4e83aae91c

For the others, it may have something to do with the definition of DLL_EXPORT.

First issue resolved by updating to latest boost, now I’ll play around DLL_EXPORT !

Things get better after playing around DLL_EXPORT, now I only have problems about boost and threads!

Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi-SVN/lib»
make[1]: Non c'è da fare nulla per «all»
make[1]: uscita dalla directory «/opt/src/vcmi-SVN/lib»
Making all in client
make[1]: ingresso nella directory «/opt/src/vcmi-SVN/client»
  CXXLD  vcmiclient.exe
vcmiclient-CCallback.o:/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/win32/condition_variable.hpp:82: undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZN5boost12thread_groupD1Ev[boost::thread_group::~thread_group()]+0x77): undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZN5boost12thread_group8join_allEv[boost::thread_group::join_all()]+0x87): undefined reference to `__imp___ZN5boost6thread4joinEv'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZN5boost6threadC1INS_3_bi6bind_tIvNS_4_mfi3mf0Iv13CThreadHelperEENS2_5list1INS2_5valueIPS6_EEEEEEEET_NS_10disable_ifINS_14is_convertibleIRSE_NS_6detail13thread_move_tISE_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<boost::_bi::bind_t<void, boost::_mfi::mf0<void, CThreadHelper>, boost::_bi::list1<boost::_bi::value<CThreadHelper*> > > >(boost::_bi::bind_t<void, boost::_mfi::mf0<void, CThreadHelper>, boost::_bi::list1<boost::_bi::value<CThreadHelper*> > >, boost::disable_if<boost::is_convertible<boost::_bi::bind_t<void, boost::_mfi::mf0<void, CThreadHelper>, boost::_bi::list1<boost::_bi::value<CThreadHelper*> > >&, boost::detail::thread_move_t<boost::_bi::bind_t<void, boost::_mfi::mf0<void, CThreadHelper>, boost::_bi::list1<boost::_bi::value<CThreadHelper*> > > > >, boost::thread::dummy*>::type)]+0x66): undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZNSt8auto_ptrIN5boost6threadEED1Ev[std::auto_ptr<boost::thread>::~auto_ptr()]+0x14): undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-CMT.o: In function `main':
/opt/src/vcmi-SVN/client/CMT.cpp:273: undefined reference to `__imp___ZN5boost6thread4joinEv'
/opt/src/vcmi-SVN/client/CMT.cpp:269: undefined reference to `__imp___ZN5boost6threadD1Ev'
/opt/src/vcmi-SVN/client/CMT.cpp:269: undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-CMT.o: In function `listenForEvents':
/opt/src/vcmi-SVN/client/CMT.cpp:567: undefined reference to `__imp___ZN5boost6thread4joinEv'
/opt/src/vcmi-SVN/client/CMT.cpp:568: undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-CMT.o:/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/win32/thread_data.hpp:161: undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE'
vcmiclient-CMT.o: In function `thread<void (*)()>':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:204: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-CMT.o: In function `thread<void (CGuiHandler::*)(), boost::reference_wrapper<CGuiHandler> >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:252: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-CMT.o: In function `thread<void (CClient::*)(), CClient*>':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:252: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-Client.o:/opt/src/vcmi-SVN/client/Client.cpp:484: undefined reference to `__imp___ZN5boost11this_thread6get_idEv'
vcmiclient-Client.o:/opt/src/vcmi-SVN/client/Client.cpp:484: undefined reference to `__imp___ZNK5boost6thread6get_idEv'
vcmiclient-Client.o:/opt/src/vcmi-SVN/client/Client.cpp:485: undefined reference to `__imp___ZN5boost6thread4joinEv'
vcmiclient-Client.o:/opt/src/vcmi-SVN/client/Client.cpp:489: undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-Client.o: In function `~CServerHandler':
/opt/src/vcmi-SVN/client/Client.cpp:563: undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-Client.o: In function `thread<void (CServerHandler::*)(), CServerHandler*>':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:252: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-Graphics.o: In function `Graphics':
/opt/src/vcmi-SVN/client/Graphics.cpp:331: undefined reference to `__imp___ZN5boost6thread20hardware_concurrencyEv'
vcmiclient-Graphics.o: In function `thread<boost::_bi::bind_t<void, boost::_mfi::mf2<void, Graphics, std::pair<std::vector<CDefEssential*> Graphics::*, std::vector<const char*> >&, bool>, boost::_bi::list3<boost::_bi::value<Graphics*>, boost::reference_wrapper<std::pair<std::vector<CDefEssential*> Graphics::*, std::vector<const char*> > >, boost::_bi::value<bool> > > >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:204: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
vcmiclient-NetPacksClient.o:/opt/src/vcmi-SVN/client/NetPacksClient.cpp:500: undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-NetPacksClient.o: In function `thread<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CClient, int>, boost::_bi::list2<boost::_bi::value<CClient*>, boost::_bi::value<int> > > >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:204: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o): In function `_Z20onUnhandledExceptionP19_EXCEPTION_POINTERS@4':
/opt/src/vcmi-SVN/lib/../CConsoleHandler.cpp:138: undefined reference to `_MiniDumpWriteDump@28'
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o):/opt/src/vcmi-SVN/lib/../CConsoleHandler.cpp:220: undefined reference to `__imp___ZN5boost6thread13native_handleEv'
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o):/opt/src/vcmi-SVN/lib/../CConsoleHandler.cpp:222: undefined reference to `__imp___ZN5boost6thread4joinEv'
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o):/opt/src/vcmi-SVN/lib/../CConsoleHandler.cpp:223: undefined reference to `__imp___ZN5boost6threadD1Ev'
../lib/.libs/libvcmi.a(libvcmi_la-CConsoleHandler.o): In function `thread<boost::_bi::bind_t<int, boost::_mfi::mf0<int, CConsoleHandler>, boost::_bi::list1<boost::_bi::value<CConsoleHandler*> > > >':
/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/detail/thread.hpp:204: undefined reference to `__imp___ZN5boost6thread12start_threadEv'
collect2: ld returned 1 exit status
make[1]: *** [vcmiclient.exe] Errore 1
make[1]: uscita dalla directory «/opt/src/vcmi-SVN/client»
make: *** [all-recursive] Errore 1

Good.

It now looks like it’s not linking with the boost-thread library.
Use “make V=1” to see if the link command line has it.

Yes… -lboost_thread_win32-mt is present during linking stage so I cannot use the most obviuos solution :imp:

make V=1
Making all in lib
make[1]: ingresso nella directory «/opt/src/vcmi-SVN/lib»
make[1]: Non c'è da fare nulla per «all»
make[1]: uscita dalla directory «/opt/src/vcmi-SVN/lib»
Making all in client
make[1]: ingresso nella directory «/opt/src/vcmi-SVN/client»
/bin/sh ../libtool  --tag=CXX   --mode=link i686-pc-mingw32-g++ -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main   -O0 -ggdb -Wall -Wno-switch-enum -Wno-sign-compare -Wcast-align -Wpointer-arith -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -L../lib  -o vcmiclient.exe vcmiclient-CCallback.o vcmiclient-CGameInterface.o vcmiclient-CThreadHelper.o vcmiclient-CDefHandler.o vcmiclient-CMusicHandler.o vcmiclient-CSndHandler.o vcmiclient-CVideoHandler.o vcmiclient-AdventureMapButton.o vcmiclient-CAdvmapInterface.o vcmiclient-CBattleInterface.o vcmiclient-CBitmapHandler.o vcmiclient-CCastleInterface.o vcmiclient-CConfigHandler.o vcmiclient-CCreatureAnimation.o vcmiclient-CCursorHandler.o vcmiclient-CGameInfo.o vcmiclient-CHeroWindow.o vcmiclient-CKingdomInterface.o vcmiclient-CMT.o vcmiclient-CMessage.o vcmiclient-CPlayerInterface.o vcmiclient-CPreGame.o vcmiclient-CSpellWindow.o vcmiclient-Client.o vcmiclient-GUIBase.o vcmiclient-GUIClasses.o vcmiclient-Graphics.o vcmiclient-NetPacksClient.o vcmiclient-SDL_Extensions.o vcmiclient-SDL_framerate.o vcmiclient-mapHandler.o ../lib/libvcmi.la -L/opt/mingw/usr/i686-pc-mingw32/lib -lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid -lSDL_ttf -lSDL_image -lSDL_mixer -lSDL -lmingw32 -lSDLmain -liconv -luser32 -lgdi32 -lwinmm -ldxguid -lwinmm -mwindows -lm -lws2_32 -lpng -ltiff -ljpeg -lz -lavformat -lswscale   -lmingw32 -lSDLmain -liconv -luser32 -lgdi32 -lwinmm -ldxguid -lwinmm -mwindows -lm -lws2_32 -lpng -ltiff -ljpeg -lz
libtool: link: i686-pc-mingw32-g++ -I/opt/mingw/usr/i686-pc-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -O0 -ggdb -Wall -Wno-switch-enum -Wno-sign-compare -Wcast-align -Wpointer-arith -DDATA_DIR="/usr/local/share/vcmi" -DBIN_DIR="/usr/local/bin" -DLIB_DIR="/usr/local/lib/vcmi" -o vcmiclient.exe vcmiclient-CCallback.o vcmiclient-CGameInterface.o vcmiclient-CThreadHelper.o vcmiclient-CDefHandler.o vcmiclient-CMusicHandler.o vcmiclient-CSndHandler.o vcmiclient-CVideoHandler.o vcmiclient-AdventureMapButton.o vcmiclient-CAdvmapInterface.o vcmiclient-CBattleInterface.o vcmiclient-CBitmapHandler.o vcmiclient-CCastleInterface.o vcmiclient-CConfigHandler.o vcmiclient-CCreatureAnimation.o vcmiclient-CCursorHandler.o vcmiclient-CGameInfo.o vcmiclient-CHeroWindow.o vcmiclient-CKingdomInterface.o vcmiclient-CMT.o vcmiclient-CMessage.o vcmiclient-CPlayerInterface.o vcmiclient-CPreGame.o vcmiclient-CSpellWindow.o vcmiclient-Client.o vcmiclient-GUIBase.o vcmiclient-GUIClasses.o vcmiclient-Graphics.o vcmiclient-NetPacksClient.o vcmiclient-SDL_Extensions.o vcmiclient-SDL_framerate.o vcmiclient-mapHandler.o -mwindows -mwindows -mwindows  -L/opt/src/vcmi-SVN/lib ../lib/.libs/libvcmi.a -lboost_system-mt -lboost_filesystem-mt -lboost_thread_win32-mt -lboost_iostreams-mt -L/opt/mingw/usr/i686-pc-mingw32/lib /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_ttf.a /opt/mingw/usr/i686-pc-mingw32/lib/libfreetype.a /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_image.a /opt/mingw/usr/i686-pc-mingw32/lib/libSDL_mixer.a /opt/mingw/usr/i686-pc-mingw32/lib/libmikmod.a /opt/mingw/usr/i686-pc-mingw32/lib/libvorbisfile.a /opt/mingw/usr/i686-pc-mingw32/lib/libvorbis.a /opt/mingw/usr/i686-pc-mingw32/lib/libogg.a /opt/mingw/usr/i686-pc-mingw32/lib/libsmpeg.a -lstdc++ -lm /opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/libstdc++.a /opt/mingw/usr/i686-pc-mingw32/lib/libSDL.a -lavformat -lswscale -lmingw32 -lSDLmain /opt/mingw/usr/i686-pc-mingw32/lib/libiconv.a -luser32 -lgdi32 -ldxguid -lwinmm -lws2_32 /opt/mingw/usr/i686-pc-mingw32/lib/libpng14.a /opt/mingw/usr/i686-pc-mingw32/lib/libtiff.a /opt/mingw/usr/i686-pc-mingw32/lib/libjpeg.a -lz
vcmiclient-CCallback.o:/opt/mingw/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/boost/thread/win32/condition_variable.hpp:82: undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZN5boost12thread_groupD1Ev[boost::thread_group::~thread_group()]+0x77): undefined reference to `__imp___ZN5boost6threadD1Ev'
vcmiclient-CThreadHelper.o:CThreadHelper.cpp:(.text$_ZN5boost12thread_group8join_allEv[boost::thread_group::join_all()]+0x87): undefined reference to `__imp___ZN5boost6thread4joinEv'

I’m trying to compile this little test program:

#include <boost/thread/thread.hpp>
#include <iostream>

void hello()
{
std::cout <<
"Hello world, I'm a thread!"
<< std::endl;
}

int main(int argc, char* argv])
{
boost::thread thrd(&hello);
thrd.join();
return 0;
}

with:

i686-pc-mingw32-g++ boostthreadtest.cpp -o boostthreadtest -lboost_thread_win32-mt

and I get:

/tmp/ccgZ54T2.o:boostthreadtest.cpp:(.text+0x96): undefined reference to `__imp___ZN5boost6thread4joinEv'
/tmp/ccgZ54T2.o:boostthreadtest.cpp:(.text+0xb4): undefined reference to `__imp___ZN5boost6threadD1Ev'
/tmp/ccgZ54T2.o:boostthreadtest.cpp:(.text+0xf4): undefined reference to `__imp___ZN5boost6threadD1Ev'
/tmp/ccgZ54T2.o:boostthreadtest.cpp:(.text$_ZN5boost6threadC1IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)]+0x58): undefined reference to `__imp___ZN5boost6thread12start_threadEv'
collect2: ld returned 1 exit status

There must be something very wrong at my side!

Looks like a C++ ABI issue. You should try to recompile boost with the same toolchain.

That’s the problem! Boost IS compiled with the same toolchain, issue seems to be only in Boost.Thread! :imp:

Is it possible you have 2 sets of boost libraries and/or headers ?

Absolutely no :frowning:, at this point the only problem could be that I’ve static boost:: thread