compiling against MSVCP70.dll instead of MSVCP80.dll in Visual Studio 2005 - visual-studio-2005

I am building a project in Visual Studio 2005 that require some libraries that were built in Visual Studio 2003. I'm getting linker errors like
msvcprt.lib(MSVCP80.dll) : error LNK2005: class std::basic_string[...]already defined in libdiguy.lib(bdiNavMesh.obj)
I believe that my program and the libraries are both compiled dynamically instead of statically. I've also tried changing the /MD and /MDd options because that seemed to be the solution to similar errors. My best guess at the moment is that it needs to link against MSVCP70.dll instead of MSVCP80.dll to resolve these errors. Is there a way I can compile against the older dll to see if that will fix it?
Thank you!

As far as I know you have two options: either get a VS2005 version of the libraries, or keep using the VS2003 headers and libraries. The first is in my opinion the better option because you will not benefit from fixes MS made in headers and libs. But it may be difficult or even impossible. The latter can be done by changing the VS2005 directories to the corresponding VS2003 ones. I think that you also have to ignore all default libraries and explicitly specify the ones from VS2003.
Hope this helps.
Cheers,
Sebastiaan

Related

What is __CxxFrameHandler4 and what does linker error "unresolved external symbol __CxxFrameHandler4" mean, exactly?

I'm using several libraries built through vcpkg (such as civet-web and prometheus-cpp), against my Visual C++ projects. When building x86 all is perfect, in x64 I get a bunch of linker errors:
error LNK2001: unresolved external symbol __CxxFrameHandler4
Searching online all references to this symbol/error are about specific projects, I cannot find what __CxxFrameHandler4 is and what problem this error is highlighting. I don't know if it's a problem with the way vcpkg is building the library, or a problem in my project or how to start looking for a solution.
I did find this blog article but it is in reference to a preview of VS2019, I cannot find any settings related to it: https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
If anyone can explain what this is all about it would be a big help.
I faced the same issues when trying to install and use cpr with vcpkg. I wanted to use cpr library in a VS2015 project.
Reason: I had VS2019 installed. vcpkg uses latest version of toolset Visual Studio.
Resolution: Add your own triplet or change existing such a way that your specified toolset is used. Adding did not work in my case so I changed existing "triplet" files in triplet folder in vcpkg. I wanted vcpkg to use toolset that comes with VS2015 (It's V140)
Content of x86-windows.cmake file
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET "v140")
set(VCPKG_DEP_INFO_OVERRIDE_VARS "v140")
Content of x64-windows.cmake file
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET "v140")
set(VCPKG_DEP_INFO_OVERRIDE_VARS "v140")
A more general answer is that this happens if you are mixing objects that were built with different platform toolsets, e.g.,
Visual C++ 2015 (v140)
Visual C++ 2017 (v141)
Typically, you (or someone else) may have built a dependency of your project with a different compiler version (platform toolset), and the fix it to change the platform toolset of either your project or the dependency (or use the correct build of the dependency, if you used a pre-built package)
I think you pointed out the right article which is
https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
I faced a similar issue in linking 64-bit library built with VC143 toolset with a 64-bit Application built with VC141 toolset.
After adding the following properties to VC143 built static library project, I was able to build the application. This disables the new feature mentioned in the above article (Exception Handling Smaller)
VS2019->Properties->C/C++->Command Line add '-d2FH4-'
VS2019->Properties->Linker->Command Line add '-d2:-FH4-'

Cannot compile - unknown flag "-pdbrpc" in "p2"

I'm trying to compile a C++ project in VS 2017. Previously I used VS 2019 but due to it's annoying bugs I moved back to 2017, but now I get and error: unknown flag "-pdbrpc" in "p2". I don't even know what this flag means and I didn't find it in .vcxproj files.
I tried to change my project's config settings to disable optimization, but didn't succeed. Also I searched that error in google but didn't find anything useful. How can I fix this annoying problem?
Had same problem. Disabling Whole Program Optimization fixed it.
You probably forgot to downgrade some projects you depend upon.
Make sure all of your projects (including static libraries you link with) use the same v141 (VS2017) Platform Toolset. It can be visible in the Solution Explorer as Project Name (Visual Studio 2017).
In my case I had a hidden project.default.props that was using $(DefaultPlatformToolset), which started to point to v142 as soon as I installed VS2019.

Visual Studio 2010 Runtime Libraries

I wrote a tool that many users would use on their computers. I noticed however, that users who do not have visual studio installed, cannot open my executable. The error says that msvcp100.dll is missing. I found in internet a redistributable package from microsoft, that should apparently provide these dlls. My question is: is there another way to bypass this problem? Something like an option in the project properties?
Yes, you can change a compiler setting to link the C++ standard library classes into your program instead of having a dependency on the DLL. Right-click your project in the Solution Explorer window, Properties. Switch to the Release configuration (upper left). C/C++, Code Generation, Runtime Library setting. Select /MT.
Only do this when you only have a single monolithic EXE. When you use your own DLLs then you really need msvcr100.dll and msvcp100.dll so that the runtime library gets shared between all modules.
It is part of C++ runtime and the target machine needs it. THere are couple of ways to address it.
Please check following link from Microsoft MCVCP100.DLL

Visual C++ executable and missing MSVCR100d.dll

I know this has been asked in other places and answered, but I'm having issues with MS Visual Studio 2010. I've developed a C++ executable but if I run the Release version on a machine that doesn't have the VC++ runtime library (ie, msvcr100d.dll), I get the "program cannot start because msvcr100d.dll is missing from your computer" error.
This is weird for two reasons:
Why is it trying to link with the debug version of the redistributable?
I tried applying this fix, setting the runtime library setting to /MT instead of /MD (multi-threaded DLL), but that only made the problem worse (if I manually copied msvcr100d.dll, it then said it couldn't find msvcp110.dll).
How can I package the runtime library with my executable so that I can run it on machines that don't have MS VC 2010 or the redistributable installed?
I know it's considered a security risk to include a copy of the DLL since it won't ever be updated, but my goal is just to send this executable to a few friends in the short term.
You definitely should not need the debug version of the CRT if you're compiling in "release" mode. You can tell they're the debug versions of the DLLs because they end with a d.
More to the point, the debug version is not redistributable, so it's not as simple as "packaging" it with your executable, or zipping up those DLLs.
Check to be sure that you're compiling all components of your application in "release" mode, and that you're linking the correct version of the CRT and any other libraries you use (e.g., MFC, ATL, etc.).
You will, of course, require msvcr100.dll (note the absence of the d suffix) and some others if they are not already installed. Direct your friends to download the Visual C++ 2010 Redistributable (or x64), or include this with your application automatically by building an installer.
For me the problem appeared in this situation:
I installed VS2012 and did not need VS2010 anymore.
I wanted to get my computer clean and also removed the VS2010 runtime executables, thinking that no other program would use it.
Then I wanted to test my DLL by attaching it to a program (let's call it program X).
I got the same error message.
I thought that I did something wrong when compiling the DLL.
However, the real problem was that I attached the DLL to program X, and program X was compiled in VS2010 with debug info. That is why the error was thrown.
I recompiled program X in VS2012, and the error was gone.
This problem explained in MSDN Library and as I understand installing Microsoft's Redistributable Package can help.
But sometimes the following solution can be used (as developer's side solution):
In your Visual Studio, open Project properties -> Configuration properties -> C/C++ -> Code generation
and change option Runtime Library to /MT instead of /MD
Usually the application that misses the .dll indicates what version you need – if one does not work, simply download the Microsoft visual C++ 2010 x86 or x64
from this link:
For 32 bit OS:Here
For 64 bit OS:Here
I got the same error.
I was refering a VS2010 DLL in a VS2012 project.
Just recompiled the DLL on VS2012 and now everything is fine.
Debug version of the vc++ library dlls are NOT meant to be redistributed!
Debug versions of an application are not redistributable, and debug
versions of the Visual C++ library DLLs are not redistributable. You
may deploy debug versions of applications and Visual C++ DLLs only to
your other computers, for the sole purpose of debugging and testing
the applications on a computer that does not have Visual Studio
installed. For more information, see Redistributing Visual C++ Files.
I will provide the link as well : http://msdn.microsoft.com/en-us/library/aa985618.aspx

Breakpoint not hooked up when debugging in VS 2008 sp1

My project has a lot of static library (with sources).
Some base libraries can't be breakpointed because the source code is different from the original version.
I know I can workaround if I turn off "Require source files to exactly match the original version" option, but that warning makes me worry.
Is it Microsoft Visual Studio 2008 bug?
I heard it happen when checksum of source code is different with obj.
I have all sources of library and linked as static library,
I cleaned and rebuilt all, but warning never disappeared.
What a worse is, when I turn off "Require source files to exactly match the original version" option, watch windows can't show what member variable has with this error "FIX: CXX0033 Error in OMF Type from Forward Class Declaration"
http://support.microsoft.com/kb/131147/en-us?fr=1
I searched stack overflow and find several similar article (http://stackoverflow.com/questions/163133/breakpoint-not-hooked-up-when-debugging-in-vs-net-2005) but those couldn't help me.
Environment :
Windows 2003 server x64
Visual Studio 2008 sp1 Version 9.0.30729.1 SP
Thanks in advance.
Double check your symbols and sources search paths to ensure they include the right folders with the static library. Check that y7ou are linking the .lib and the .obj files from the right directory. Also, break in program under the debugger, and check where are the symbols for the library loaded from - they should be from the same folder the .obj and the .lib came from.

Resources