User forums > Using Code::Blocks

Howto - Cross Compiling in Linux using MingW32

<< < (12/25) > >>

era506:
Wow! I'm an idiot!!! You were absolutely right!! I didn't read the part that says "belonging to the whole project have to be empty"!! :oops: After that I didn't get any errors but the proyect still didn't run, so I executed "wine Prueba.exe" from gnome-terminal and the following output showed:


--- Code: ---era506@era506-desktop:~/Desktop/Prueba/bin$ wine Prueba.exe
err:module:import_dll Library mingwm10.dll (which is needed by L"Z:\\home\\era506\\Desktop\\Prueba\\bin\\Prueba.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\home\\era506\\Desktop\\Prueba\\bin\\Prueba.exe" failed, status c0000135

--- End code ---

Then, I remembered reading something about mingwm10.dll on your howto, so I ungzipped the .dll from /usr/share/doc/mingw32-runtime/ to the Prueba.exe's directory and voilĂ ! It worked!! I apollogize for not reading carefully!!  :oops:
Thank you very much for your help!!!

pianoplayer326:
hi, I'm having some trouble cross-compiling and am lost as to what step to take next in finding out how to make it work (not something that happens often).  The basic "hello, world" console app compiles fine but I have a project that I've been working on that won't compile for windows and I have some general questions regarding the process,

my project uses libraries glfw, ftgw, and box2d.  It doesn't seem the problem is in libraries though because the error messages have only to do with header files, like in this one example:


--- Code: ---In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/i586-mingw32msvc/bits/c++locale.h:49,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/iosfwd:45,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/stl_algobase.h:70,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/memory:53,
                 from /usr/include/freetype2/../Source/Dynamics/b2Body.h:26,
                 from /usr/include/Box2D.h:41,
                 from /home/dantarius/codeblocks/physics/main.cpp:6:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio: At global scope:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:171: error: ‘::vfscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:172: error: ‘::vscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:174: error: ‘::vsscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:182: error: ‘__gnu_cxx::vfscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:183: error: ‘__gnu_cxx::vscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:185: error: ‘__gnu_cxx::vsscanf’ has not been declared

--- End code ---

the errors are coming from well-established files like cstdio, cwchar, and cstdlib, which leads me to believe that there are some odd #defines happening.  as far as I know, there aren't any platform-specific #defines happening aside from the windows-type ones from this tutorial, as these libraries are multi-platform.  do I have to compile a new, different set of libraries for these sub-systems, in order to successfully cross-compile a windows binary?  I'll throw in the entire build log for good measure.


--- Code: ---Compiling: main.cpp
In file included from /usr/include/freetype2/../Source/Collision/Shapes/../../Common/b2Math.h:25,
                 from /usr/include/freetype2/../Source/Collision/Shapes/b2Shape.h:22,
                 from /usr/include/freetype2/../Source/Collision/Shapes/b2CircleShape.h:22,
                 from /usr/include/Box2D.h:36,
                 from /home/dantarius/codeblocks/physics/main.cpp:6:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:164: error: ‘::lldiv_t’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:170: error: ‘::_Exit’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:177: error: ‘::llabs’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:179: error: ‘lldiv_t’ does not name a type
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:183: error: ‘::lldiv’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:198: error: ‘::strtof’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:199: error: ‘::strtold’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:206: error: ‘__gnu_cxx::lldiv_t’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:208: error: ‘__gnu_cxx::_Exit’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:211: error: ‘__gnu_cxx::llabs’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:212: error: ‘__gnu_cxx::div’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:213: error: ‘__gnu_cxx::lldiv’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:216: error: ‘__gnu_cxx::strtof’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdlib:219: error: ‘__gnu_cxx::strtold’ has not been declared
In file included from /usr/include/Box2D.h:39,
                 from /home/dantarius/codeblocks/physics/main.cpp:6:
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h: In member function ‘virtual void b2ContactListener::Add(const b2ContactPoint*)’:
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h:95: warning: statement has no effect
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h: In member function ‘virtual void b2ContactListener::Persist(const b2ContactPoint*)’:
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h:99: warning: statement has no effect
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h: In member function ‘virtual void b2ContactListener::Remove(const b2ContactPoint*)’:
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h:103: warning: statement has no effect
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h: In member function ‘virtual void b2ContactListener::Result(const b2ContactResult*)’:
/usr/include/freetype2/../Source/Dynamics/b2WorldCallbacks.h:106: warning: statement has no effect
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/i586-mingw32msvc/bits/c++locale.h:49,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/iosfwd:45,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/stl_algobase.h:70,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/memory:53,
                 from /usr/include/freetype2/../Source/Dynamics/b2Body.h:26,
                 from /usr/include/Box2D.h:41,
                 from /home/dantarius/codeblocks/physics/main.cpp:6:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio: At global scope:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:171: error: ‘::vfscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:172: error: ‘::vscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:174: error: ‘::vsscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:182: error: ‘__gnu_cxx::vfscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:183: error: ‘__gnu_cxx::vscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cstdio:185: error: ‘__gnu_cxx::vsscanf’ has not been declared
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/postypes.h:46,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/iosfwd:49,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/stl_algobase.h:70,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/memory:53,
                 from /usr/include/freetype2/../Source/Dynamics/b2Body.h:26,
                 from /usr/include/Box2D.h:41,
                 from /home/dantarius/codeblocks/physics/main.cpp:6:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:153: error: ‘::fwide’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:154: error: ‘::fwprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:155: error: ‘::fwscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:164: error: ‘::swprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:165: error: ‘::swscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:167: error: ‘::vfwprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:169: error: ‘::vfwscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:171: error: ‘::vswprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:173: error: ‘::vswscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:175: error: ‘::vwprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:177: error: ‘::vwscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:194: error: ‘::wcstof’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:205: error: ‘::wprintf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:206: error: ‘::wscanf’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:253: error: ‘::wcstold’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:262: error: ‘::wcstoll’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:263: error: ‘::wcstoull’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:270: error: ‘__gnu_cxx::wcstold’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:271: error: ‘__gnu_cxx::wcstoll’ has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:272: error: ‘__gnu_cxx::wcstoull’ has not been declared
In file included from /home/dantarius/codeblocks/physics/main.cpp:12:
/home/dantarius/codeblocks/physics/camera.h: In function ‘void cameradragcb(int, int)’:
/home/dantarius/codeblocks/physics/camera.h:85: warning: unused variable ‘t’
In file included from /home/dantarius/codeblocks/physics/main.cpp:17:
/home/dantarius/codeblocks/physics/mainloop.h: In function ‘void mainloop()’:
/home/dantarius/codeblocks/physics/mainloop.h:52: warning: unused variable ‘t’
Process terminated with status 1 (0 minutes, 0 seconds)
40 errors, 6 warnings

--- End code ---

command line:


--- Code: ---i586-mingw32msvc-g++  -Wall  -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__   -I/usr/include -I/usr/include/freetype2 -I/usr/include -I/usr/include/freetype2 -I/usr/i586-mingw32msvc/include  -c /home/dantarius/codeblocks/physics/main.cpp -o .objs/main.o
--- End code ---

thanks for any help in advance,
brad

Biplab:

--- Quote from: pianoplayer326 on January 04, 2009, 02:59:50 am ---
--- Code: ---i586-mingw32msvc-g++  -Wall  -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__   -I/usr/include -I/usr/include/freetype2 -I/usr/include -I/usr/include/freetype2 -I/usr/i586-mingw32msvc/include  -c /home/dantarius/codeblocks/physics/main.cpp -o .objs/main.o
--- End code ---

--- End quote ---

Remove -I/usr/include -I/usr/include/freetype2 -I/usr/include -I/usr/include/freetype2 from Compiler options. I'm quite sure that they contain header meant to be used in Linux.  :)

pianoplayer326:
I removed the original include directories and manually copied the sub-system headers I needed into the mingw-include area.  the header errors are gone!  for now.. but now I'm getting some other errors (undefined references) so I'll fiddle around with my libraries for a while.  I hope I don't have to compile an entirely different set for windows!  If that's what it takes, though, it'd still be worth it... tomorrow, lol.  if anyone still has ideas though I'm all ears.  Thanks for the tip Biplab!

Jenna:

--- Quote from: pianoplayer326 on January 04, 2009, 05:18:05 am ---I removed the original include directories and manually copied the sub-system headers I needed into the mingw-include area.  the header errors are gone!  for now.. but now I'm getting some other errors (undefined references) so I'll fiddle around with my libraries for a while.  I hope I don't have to compile an entirely different set for windows!  If that's what it takes, though, it'd still be worth it... tomorrow, lol.  if anyone still has ideas though I'm all ears.  Thanks for the tip Biplab!

--- End quote ---

You can not use the same library for linux and windows builds.
the linux libs are under "/usr/lib[32|64]/" or "/usr/local/lib[32|64]", the windows libs under "/usr/i586-mingw32msvc/lib".

That a library is a cross-platform only means that the sources can be compiled on different platforms, the binaries are different.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version