Replies: 6 comments
-
Here's the vcpkg settings I have for all the projects: |
Beta Was this translation helpful? Give feedback.
-
It seems I'm going backwards. Previously I was able to compile some of my static libraries, and linking only failed when the top-level application was trying to pull in the libraries. Now, even my static libraries won't compile because 'vcpkg install' is failing:
I can't understand what's going on with the 'failed to fetch ref HEAD' error. |
Beta Was this translation helpful? Give feedback.
-
Hmm, it appears that more than one thing might be going on here and the issue above could be due to network connectivity. |
Beta Was this translation helpful? Give feedback.
-
Ok, now I'm back to the original issue: runtime library mismatch. The previous error was due to poor network connectivity. |
Beta Was this translation helpful? Give feedback.
-
A bit more information:
|
Beta Was this translation helpful? Give feedback.
-
The CRT in your project and in libraries provided by vcpkg (usually) should match. |
Beta Was this translation helpful? Give feedback.
-
I have a Windows MFC C++ application solution with several projects contained in the solution, developed in VS 2022. Some of the projects yield static libraries which are used by the top-level application.
I'd like to use the 'cpr' library via vcpkg but I'm having some difficulty. I've tried following some guides for both non-Visual Studio integrated, and using the integrated vcpkg. For now, I'd like to focus on using the integrated package just to keep things as simple as possible (as far I know, I have no need for anything unusual).
I've now removed VCPKG_ROOT from my path in an attempt to prevent confusion between the built-in vcpkg and the Visual Studio version.
In Visual Studio, one of the top-level application projects is failing to compile with LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in project.obj project C:\XXXXX\cpr.lib(cprtypes.cpp.obj) 1
I can see at some level what this means: my project is compiled as multi-thread static debug, and the cpr library presumably is compiled as Multithreaded DLL in dynamic release mode, which are incompatible. What I don't understand is why is is happening.
I do have a vcpkg.json file in the root folder of my solution, with the contents:
I also have a file vcpkg-configuration.json containing the following:
A few questions I couldn't answer from the docs: If I'm using vcpkg to compile a static library project.lib with external dependency cpr.lib (presumably provided by vcpkg), do the other packages requiring project.lib also have to use vcpkg or should they point to the compiled pcr.lib file without worrying about/using vcpkg?
Should I have one vcpkg.json in the solution root folder or one per project folder?
How does vcpkg (in Visual Studio) choose a Runtime Library to target when it compiles a .lib in vcpkg.json?
I tried enabling vcpkg + manifest in my top-level application where the build is failing, and I get this:
Please let me know what additional info would be helpful.
Beta Was this translation helpful? Give feedback.
All reactions