Crosscompiling from Linux for Windows
Author
Message
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: 2010-07-22, 13:31 Crosscompiling from Linux for Windows
I know that crosscompiling from a Linux box is not a supported way to get a windows binary but can I describe here some issues I'm currently having?
Thanks,
Marco
Last edited by DiAppoggio on 2010-08-28, 18:24; edited 1 time in total
ubuntux
Joined: 11 Apr 2009 Posts: 138
Posted: 2010-07-22, 14:52
Why not. At least it's always fun to see how other people are mistreating their systems :)
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: 2010-08-13, 15:04 Crosscompiling
Infact I'm a sado masochistic
Anyway, on Ubuntu 10.04 I've built a cross compiling toolchain mainly composed of:
GCC 4.5.0
SDL 1.2.14
BOOST 1.43.0
(something else)
Then i made a SVN checkout (now at rev1741) and configured with
Code: 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:
Code: 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:
Code: 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?
ubuntux
Joined: 11 Apr 2009 Posts: 138
Posted: 2010-08-13, 15:29
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.
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: 2010-08-13, 16:16
ubuntux wrote: 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...
Code: 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
ubuntux
Joined: 11 Apr 2009 Posts: 138
Posted: 2010-08-14, 07:16
Try removing the DLL_EXPORT in HeroBonus.cpp:16. It might conflict with the declaration in the header file.
Tow
Project Lead VCMI Programmer
Joined: 01 Feb 2008 Posts: 810 Location: Kraków, Poland
Posted: 2010-08-15, 09:59
If that doesn't help, try removing const both from definition in HeroBonus.cpp:16 and declaration in HeroBonus.h.
_________________ VCMI is a work in progress.
VCMI is NOT an another mod.
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: 2010-08-28, 18:23
ubuntux wrote: Try removing the DLL_EXPORT in HeroBonus.cpp:16. It might conflict with the declaration in the header file.
Third make after last suggestions:
Code: 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: Code: extern C_LINKAGE int SDL_main(int argc, char *argv[]);
while CCallback.h : Code: friend int main(int argc, char** argv);
Don't flame, but I've changed Code: friend int main(int argc, char** argv);
to Code: friend int main(int argc, char** argv[]);
Fourth make:
Code: 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!
Tow
Project Lead VCMI Programmer
Joined: 01 Feb 2008 Posts: 810 Location: Kraków, Poland
Posted: 2010-08-29, 01:14
DiAppoggio wrote: Don't flame, but I've changed
friend int main(int argc, char** argv);
friend int main(int argc, char** argv[]);
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[]".
DiAppoggio wrote: error: invalid conversion from 'int (*)()' to 'void*'
Try adding C-style cast:
Code: 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)
_________________ VCMI is a work in progress.
VCMI is NOT an another mod.
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: 2010-08-29, 15:54
Tow wrote: DiAppoggio wrote: Don't flame, but I've changed
friend int main(int argc, char** argv);
friend int main(int argc, char** argv[]);
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[]".
DiAppoggio wrote: error: invalid conversion from 'int (*)()' to 'void*'
Try adding C-style cast:
Code: 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
Code: 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
DiAppoggio
Joined: 22 Jul 2010 Posts: 6
Posted: Today 12:22
ubuntux wrote: Why not. At least it's always fun to see how other people are mistreating their systems :)
I really can't pass this no-linking problem... maybe I'll attempt to recompile my toolchain, see you later and thanks for patience!