c++ - mingw g++ is unable to link with libraries -
i'm trying use x86_64-w64-mingw32-g++
(packaged in archlinux's mingw package) cross compile c++ code windows executable, i'm having trouble getting past issues.
i'm calling
x86_64-w64-mingw32-g++ -o build_win/asm build_win/asm.o build_win/asm_lib.o build_win/socket_boost.o -i../extra/etc -fopenmp -lrt -std=c++11 -g -lboost_system -lboost_serialization
from makefile, thrown errors:
/usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lrt /usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lboost_system /usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lboost_serialization
this works fine native g++, have change mingw compile?
edit: have mingw-w64-boost
package installed, includes boost libraries pre-compiled , ready linked. however, seems naming convention bit different, , -lboost_system
example becomes -llibboost_system-mt
(not sure -mt suffix entails).
problem can't find mingw counterpart -lrt
. i've tried both -lrtm
, -lrtutils
in both cases get:
[...] undefined reference `__imp_getsockopt'
are sure -lboost_system
, other libraries present in same directory makefile ?
if not
please include -l
flag indicates location of library.
for example:
-l /path_openmp -fopenmp -l /path_boost_system/ -lboost_system -l /path_serialization -lboost_serialization
moreover, need not include -i
, -g
flag when creating executable .o
files. these needed when create .o
.cpp
files.
Comments
Post a Comment