c++ - g++ linking a static library error -



c++ - g++ linking a static library error -

i'm relatively new c++ , i'm used working in visual studio 2013 environment. need utilize library in project i'm working on: https://github.com/s3rvac/cpp-bencoding

my first question is: matter if build library in visual studio or gcc (mingw-w64)?

anyway, built using gcc (4.9.2) since author did in instructions on github. got no errors , produced library called libbencoding.a

now want link lib-file own project. stuck. created simple hello world programme (main.cpp). location of libbencoding.a in folder c:\...\cpp-bencoding\build\src

g++ main.cpp -l "c:\...\cpp-bencoding\build\src" -l libbencoding -o foo.exe -std=c++11

however produces error message:

c:/program files (x86)/mingw-w64/i686-4.9.2-posix-dwarf-rt_v4-rev2/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibbencoding collect2.exe: error: ld returned 1 exit status

i appreciate help here.

thanks in advance!

if project compiled , linked using visual studio 2013, project can have compilation , link error in mingw, because implement different set of c++ standard or if utilize non-standard language features.

as allan.simon mention, can't utilize .a library in programme compiled visual studio , vice versa because of lack of standard abi (it possible if utilize c compiler).

the project cpp-bencoding uses cmake, can seek compile using visual studio.

one more thing, when utilize mingw, order of libraries matter. can compile project options -lmylib1 -lmylib2 -lmylib3 using visual studio, mingw can give link errors (undefined references).

the details can find here

c++ gcc

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 -