c - How do I make the MinGW cross compiler use the same libraries as gcc? -



c - How do I make the MinGW cross compiler use the same libraries as gcc? -

my programme uses gnu multiple precision arithmetic library deal numbers of arbitrary size. compile using gcc with:

gcc main.c -o diff -g -lgmp

however, when seek utilize mingw crosscompiler compiler, next error:

i686-w64-mingw32-gcc main.c -o diff.exe -g -lgmp main.c:3:46: fatal error: gmp.h: no such file or directory #include <gmp.h>//for files of arbitrary size

i tried tell header file was:

i686-w64-mingw32-gcc main.c -o diff.exe -i/usr/include -g -lgmp /usr/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status

ok, figure found header, cant find library. tried again:

i686-w64-mingw32-gcc main.c -o diff.exe -i/usr/include -g -l/usr/lib -lgmp /usr/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status

i guess need specify exact files use, tried this:

i686-w64-mingw32-gcc main.c -o diff.exe -i/usr/include -g /usr/lib/libgmp.so /usr/lib/libgmp.so: file not recognized: file format not recognized collect2: error: ld returned 1 exit status

so, don't know , i'd really appreciate help.

first, disclaimer: cross-compiler using neither distributed by, nor supported mingw.org, whom represent; if looking pre-compiled solution, should seek distributor of specific cross-compiler itself.

that said, can offer next insight, (which apply, in general, cross-compiler): headers find in /usr/include, or in /usr/local/include, , libgmp.so find in /usr/lib, or in /usr/local/lib, intended utilize native platform compiler. not suitable for, , cannot used mingw cross-compiler; attempting certainly never work. thus, have 2 options:

ask cross-compiler distributor provide pre-compiled re-create of gmp.dll, (or @ least, compatible import library, although may need gmp.dll distribute own application anyway), , associated header files, and/or equivalent statically linkable library, utilize cross-compiler.

use cross-compiler build gmp.dll yourself, install it, associated headers, , perhaps associated import library and/or equivalent statically linkable library, same prefix-path cross-compiler itself.

c linux gcc mingw

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -