visual studio - Clang+LLVM static library linking error on Windows - Why would the symbols be different? -


after compiling clang , llvm following instruction on llvm website try linking built static libs in test app. code built v110 of vs toolset. im getting linker errors of type "error lnk2001" , "error lnk2019".

the app appears put libs in bucket symbol resolution. verbose linker output can see being dismissed:

1> unused libraries: ... 1> c:\sdk\llvm\debug\lib\clangtooling.lib ...

digging little deeper have found symbols in error message , ones in libs not quite same.

-here example-

linker error =>

*unresolved external symbol "public: int __cdecl clang::tooling::clangtool::run(class clang::tooling::toolaction )" (?run@clangtool@tooling@clang@@qeaahpeavtoolaction@23@@z) referenced in function main

...giving "?run@clangtool@tooling@clang@@qeaahpeavtoolaction@23@@z" symbol name.

now using "dumpbin /symbols" on built version of clangtooling.lib =>

*fda 00000000 undef notype () external | ?run@clangtool@tooling@clang@@qaehpavtoolaction@23@@z (public: int __thiscall clang::tooling::clangtool::run(class clang::tooling::toolaction ))

... can see the symbol im looking called "?run@clangtool@tooling@clang@@qaehpavtoolaction@23@@z"

there subtle difference near beginning of address. here again side side comparison.

?run@clangtool@tooling@clang@@qeaahpeavtoolaction@23@@z << error message

?run@clangtool@tooling@clang@@qaehpavtoolaction@23@@z << dumpbin output

why these not match?

thanks

so turns out llvm/clang libraries had built 32 bit while test project building 64 bit. have successful built test project using 32 bit binaries. notes on answer unresolved externals in c++: visual c++ mangles method signature differently mangled method in dll describe issue in more detail.

*note else looking linking llvm libs. cmake documentation llvm/clang (found here http://llvm.org/docs/cmake.html) makes sound defaults 64 bit on 64 bit system. on windows7 64bit/visualstudio11 (at least on machine) isnt case. haven't yet found option support 64 bit compilation cmake menu. seems option embed 32 bit apps.


Comments

Popular posts from this blog

android - Automated my builds -

how to proxy from https to http with lighttpd -

python - Flask migration error -