<div dir="auto">Link with version.lib instead?<div dir="auto"><br></div><div dir="auto">- Kim </div></div><div class="gmail_extra"><br><div class="gmail_quote">Den 7 aug. 2017 5:52 em skrev "Russell Wallace via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to compile a program that is intended to use Clang as a library, and getting an error where it tries to link in some symbols that are not actually available.<div><br></div><div>Windows 7</div><div>Visual Studio 2017</div><div>LLVM 4.0.1</div><div>Everything 64-bit, and I built LLVM myself</div><div><br></div><div>// minimal test program</div><div><div>#include <clang/Frontend/<wbr>CompilerInstance.h></div></div><div><div>int main(int argc, char **argv) {</div></div><div><div>  clang::CompilerInstance ci;</div><div>  return 0;</div><div>}</div></div><div><br></div><div>cl /I\llvm\build\include /I\llvm\build\tools\clang\<wbr>include /I\llvm\include /I\llvm\tools\clang\include /J /MTd /Zi test.cpp \llvm\build\Debug\lib\*.lib<br></div><div><br></div><div><div>clangDriver.lib(MSVCToolChain.<wbr>obj) : error LNK2019: unresolved external symbol GetFileVersionInfoSizeW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::<wbr>MSVCToolChain::<wbr>getMSVCVersionFromExe(void)<wbr>const " (?getMSVCVersionFromExe@<wbr>MSVCToolChain@toolchains@<wbr>driver@clang@@AEBA?<wbr>AVVersionTuple@4@XZ)</div><div>clangDriver.lib(MSVCToolChain.<wbr>obj) : error LNK2019: unresolved external symbol GetFileVersionInfoW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::<wbr>MSVCToolChain::<wbr>getMSVCVersionFromExe(void)<wbr>const " (?getMSVCVersionFromExe@<wbr>MSVCToolChain@toolchains@<wbr>driver@clang@@AEBA?<wbr>AVVersionTuple@4@XZ)</div><div>clangDriver.lib(MSVCToolChain.<wbr>obj) : error LNK2019: unresolved external symbol VerQueryValueW referenced in function "private: class clang::VersionTuple __cdecl clang::driver::toolchains::<wbr>MSVCToolChain::<wbr>getMSVCVersionFromExe(void)<wbr>const " (?getMSVCVersionFromExe@<wbr>MSVCToolChain@toolchains@<wbr>driver@clang@@AEBA?<wbr>AVVersionTuple@4@XZ)</div></div><div><br></div><div>These symbols are nominally available in mincore.lib, but not really; adding that to the link, produces an executable that won't run without an obscure DLL that is not present on many Windows machines, so it's necessary to avoid bringing them in, in the first place.</div><div><br></div><div>clang.exe itself runs fine, which is presumably an existence proof that this is possible.</div><div><br></div><div>Same problem arises with release build, and with a minimal library set instead of *.lib.</div><div><br></div><div>What is the recommended way to solve this problem?</div></div>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div></div>