Shared symbols between Visual Studio libraries

  • Thread starter Thread starter Eric Clinch
  • Start date Start date
E

Eric Clinch

Guest
I'm attempting to compile a project on Windows using the Visual Studio compiler. I've gotten the project to compile on Linux multiple times before, but this is my first time trying to compile it on Windows. I'm using Bazel, which supports Windows compilation through the Visual Studio Build Tools, for the project management/building. When compiling, the project has to link with third-party libraries. Specifically, I'm using the Coin-OR library, which has Windows versions which can be seen here: Index of /download/binary/CoinAll. The version I'm using is CoinAll-1.6.0-win64-intel11.1. I'm no expert on how to use the Visual Studio compiler, so to get the linker to see these libraries I just copy-pasted them into the lib/x64 folder in my Visual Studio 2017 Build Tools. I realize this was very crude and not the best way to get this done, but it seemed to work in that it allowed the linker to see and open the libraries. However, the linker then complained about not being able to open the 'libmmt.lib' library, which I found was part of the Linux C++ compiler. So then I downloaded that compiler and its associated libraries, and again I copy-pasted the libraries from that into the lib/x64 folder.

This leads me to where I'm at now. When I attempt to compile, I get a large chain of errors complaining about the same symbols being defined in two different libraries (the ... already defined in ... error) or about unresolved external symbols. All of the symbols overlaps errors seem to involve the msvcprt.lib library.

Here's the linking command that's failing:

C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/link.exe /nologo /OUT:bazel-out/x64_windows-fastbuild/bin/main/foo.exe /SUBSYSTEM:CONSOLE /MACHINE:X64 @bazel-out/x64_windows-fastbuild/bin/main/foo.exe-2.params /DEBUG:FASTLINK /INCREMENTAL:NO

I assume I'm doing something incredibly dumb but I don't have enough experience with compiling on Windows to know what. I'd greatly appreciate it if someone could shed some light on my issue.

Continue reading...
 
Back
Top