1

I am porting some c++ code that was compiled with cmake and gcc under Linux to a larger Windows project. We are using Microsoft Visual Studio 2013, and the project is a simple command line tool, built in release mode, x64. I am getting a bunch of linker errors when linking against libxml2 and libxslt. First I tried downloading prebuilt binaries, but when this didn't work, I tried building libxml2 and libxslt myself. I downloaded the source for libxml2-2.7.8, and built it like so:

cscript configure.js compiler=msvc-12.0 modules=no http=no ftp=no python=no schematron=no iconv=no static=yes
nmake

This was successful, yielding libxml2.lib and libxml2_a.lib. I then added the paths to these libraries to the linker path in my project settings, and added the library names to the linker input additional dependencies. I followed these same instructions for libxslt. When I build my project in MSVC, I get the following errors:

Error   1   error LNK2001: unresolved external symbol xsltParseStylesheetFile   C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq

Error   2   error LNK2001: unresolved external symbol xmlSubstituteEntitiesDefault  C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   3   error LNK2001: unresolved external symbol xmlFreeDoc    C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   4   error LNK2001: unresolved external symbol xmlCleanupParser  C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   5   error LNK2001: unresolved external symbol xsltCleanupGlobals    C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   6   error LNK2001: unresolved external symbol xmlLoadExtDtdDefaultValue C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   7   error LNK2001: unresolved external symbol xsltFreeStylesheet    C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   8   error LNK2001: unresolved external symbol xsltApplyStylesheet   C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   9   error LNK2001: unresolved external symbol exsltRegisterAll  C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq
Error   10  error LNK2001: unresolved external symbol xmlParseFile  C:\Users\aday\Source\Workspaces\Illumina.Isis\Dev\Trunk\Src\bcl2fastq\DemuxReportGenerator.obj  bcl2fastq

I have no idea why these linker errors are occurring. The libraries are in the path, and explicitly linked against. If I move the library aside, and try to build, I get an error message telling me it can't find the file. So I know that it sees the files, but for some reason it can't read the symbols out of them. I tried building the libraries with every conceivable combination of parameters without success. I tried linking against libxml2_a.lib and libxml2.lib. I am successfully linking against similarly built boost libraries. Why am I getting these linker errors?

Pang
  • 9,564
  • 146
  • 81
  • 122
  • Are those c libs or c++ libs? If they are c libs - do the headers contain ``extern "C"`` blocks? (Name mangling...) Does it resolve any functions from the libs or do all references fail? – BitTickler Apr 03 '15 at 01:46
  • How on earth is this question a duplicate? Everything on the supposed answer is stuff any decent programmer already knows. Why don't we mark all questions as duplicates under: logic and math, as everything derives from that. – user3174730 Apr 03 '15 at 16:04
  • 1
    It turns out there are multiple command prompts with Visual Studio, 1 for x64, and one for x86. To build with x64, you need to explicitly use the x64 version. NOTE THAT THIS INFORMATION WAS NOT IN THE SUPPOSED ALREADY ANSWERED QUESTION LINK! – user3174730 Apr 03 '15 at 16:10

0 Answers0