0

I am struggling with compiling and/or linking shaderc library. I need it for a raytracing framework with vulkan for a computer graphics course.

Setup

Since this should be used by students, I wanted to keep everything nice and ordered, so I have two projects in my solution:

  1. Lib, the actual framework. It depends on glfw3.lib, vulkan-1.lib and shaderc_combined.lib.
  2. App, this is where the students can toy around with he framework and it's the startup-project. It has a dependency on Lib

I build the library from source using cmake and Visual Studio 2019, like this:

mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
cmake . --build --config Debug

Errors

I now wan't to link the shaderc_combined.lib to my project Lib, but get the following two errors (actually I get those two errors several times for different .obj files):

1>Lib.lib(shaderc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj
1>Lib.lib(shaderc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MD_DynamicRelease' in main.obj

How I understand it:

  1. The first error tells me, that shaderc_combined.lib is build in release mode for some reason (like stated in this question)

  2. The second error means, I think, that shaderc_combined.lib links to another version of the runtime library. (As stated in the Microsoft docs, although I don't understand it completly)

Please corretct me, if my understanding of those errors is wrong.

My questions

  1. How can I compile shaderc_combined.lib in "real" Debugmode? (Always building in Release mode is not acceptable)
  2. Can I run into more trouble when I'm changing /MDd to /MTd? I don't understand the difference between the two options completly.

Preferably both should be achievable without manually editing the Makefile or the build files generated by cmake, because this would make it just harder for other people to compile my project.

Thanks in advance and feel free to correct spelling mistakes :)

Community
  • 1
  • 1
Lukas-T
  • 11,133
  • 3
  • 20
  • 30

1 Answers1

0

So, the problem solved itself more or less, thanks to a hint from the comments.

  1. I checked my linker settings again and it turns out I just confused the paths to the required libraries.
  2. One can run cmake on shaderc with -DSHADERC_ENABLE_SHARED_CRT=ON to force shaderc to use /MD instead of /MT then some examples don't compile anymore, but the rest works fine.
Lukas-T
  • 11,133
  • 3
  • 20
  • 30