wrap a library in a vs2013 project to be used in vs2017? - c++

My c++ project is using TIBCO's TIBRV library (namely libtibrv.lib, libtibrvcpp.lib), TIBRV x64 version files were compiled by vs10, previously my project was compiled in VS2013 and everything is fine.
Now, when I upgrade my project to VS2017, an LNK2001 error is triggered saying "unresolved external symbol __iob_func referenced ", this is due to Microsoft changed its CRT pathes and libraries (see
https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/ ) since VS 2015.
However, as there is no maintenance agreement anymore, TIBCO wouldn't provide a x64 TIBRV version compiled in VS2017.
Hence I wonder, is there a way to wrap the TIBRV x64 library files (libtibrv.lib, libtibrvcpp.lib) compiled under VS10, in VS2013, then called from VS2017? How to do that?

Related

link MinGW gcc c++ application against mvsc c++ .lib

I need to integrate the Intel RealSense C++ library (legacy 2016 R3 not the current 2.0 SDK) to an already existing application built with Qt MinGW g++ 32-bit (installed by Qt5.11 offline installer)
basically, they provide the headers and some .lib files to compile and link applications
when I try to compile the Segmentation example in Visual Studio, they work, (they provide a .props file that I can add to the Visual Studio Solution's Project's Property Manager, btw, I am using Visual Studio Community 2017 on Windows 10 Home 64-bit), but, the application I am developing was made using QtCreator so I need to be able to compile with QtCreator, and migrating the build to Visual Studio might not be a viable solution
if I try to compile the Segmentation example with MinGW (32-bit) in QtCreator (installed by Qt5.11 offline installer) I get error messages like this one
C:\src\Debug\app\main.cpp:34: error: undefined reference to `UtilCmdLine::UtilCmdLine(Intel::RealSense::Session*, int)'
and even if I try to use MSVC (64-bit) in QtCreator (installed by Qt5.11 offline installer) (which is not really a great option)
I get error messages like this one
C:\src\Debug\app\main.cpp.obj:-1: error: LNK2019: unresolved external symbol PXCSession_CreateFromPath referenced in function "public: static class Intel::RealSense::SenseManager * __cdecl Intel::RealSense::SenseManager::CreateInstance(wchar_t const *)" (?CreateInstance#SenseManager#RealSense#Intel##SAPEAV123#PEB_W#Z)
for several symbols
has anyone solved a similar problem?
MinGW I think I understand not working, because of MSVC symbol mangling and a general different ABI, and because the tools to work with .lib files in MinGW are no longer being available (at least not in the official website), but why is MSVC not working? am I missing something that Visual Studio has that QtCreator does not?
would there be a way to make something like a wrapper library in visual studio so that I can use in MinGW? I saw some people who had similar problems with .lib files being told to use a COM style interface if they could
I saw that being the
just to clarify, I'm not sure if it's a problem introduced by the Qt libraries but there is some of the application's code just doesn't compile correctly with MSVC, so for now, I'd prefer a way to compile with MinGW in QtCreator, though we might eventually get it to work with both compilers (or at least try to)

Multiple symbol definitions when using Visual Studio 2015

I have a autotools project that I've added a Visual Studio solution and project file for, and everything builds fine until I get to the linking stage. I get this output. An excerpt:
error LNK2005: "public: static bool const std::numeric_limits<unsigned short>::is_signed" already defined in abstract_syntax_graph.obj
Basically, a bunch of multiple definitions for C++ standard library stuff. I'm guessing there is something wrong with my project configuration in Visual Studio but I have no idea what would control whatever feature that is.
I faced similar errors when compiling a project under VS2015 using the /Za flag. Note that this worked fine under VS2013, but wouldn't build until I removed /Za from the VS2015 project.
This doesn't seem like an actual answer to me, I would have thought that there should be no issue disabling language extensions.

MSVCR100D.dll is missing when build/running project from another PC/VS

I uploaded my (VS2013) project folder and provided it to the other members of my team, but when they tried to build/run it, using Visual Studio 2012 they got this error, it also happened on their version of Visual Studio 2013.
The program can't start because MSVCR100D.dll is missing from your computer. Try reinstalling the
program to fix this problem.
They reinstalled VS2010 but no go.
I also tried to statically link my project by using /MT in the Code Generation options but now I get:
Unresolved External Symbol __free_dbg libcmptd.lib cout.obj
....25 more...
How can I get it so my project can be build/ran on my team members pc? How do I resolve the unresolved externals? It seems to happen purely with regular Microsoft files.
You are mixing C++ libraries built with different versions of the compiler (and as we know some of them are linked against debug dynamic version of VC10 runtime library). This is not supported, as different compiler versions have different ABIs.
To fix the mess you need to find libraries built with parameters that match parameters of your project. They should be built:
with the same compiler version (ex. VS 2013)
with the same configuration (Debug/Release)
against the same platform (x86/x64/ARM)
against the same runtime library variant (static/dynamic + debug/release)
You could either try to find prebuilt versions on the web or to build libraries yourself from source codes. Often, you will want to have multiple configuration/platforms for your project and, thus, you will need multiple versions of your libraries.
If your search will not succeed (for example if there is no VS2013 build for a closed source library) you could roll back your project to another version of compiler and to start over.
Any attempts to link incompatible libraries even if somehow succeeded will lead to random crashes.
This message generally states that the dll is referred to directly or indirectly in your application and is missing.
The 'D' at the end show us this is the Debug version of the file, this is DLL file is provided with the Visual Studio 2010 installation. So the MSVCR100D.dll would be provided with the installation of Visual Studio 2010.
Of course, you could be missing other versions 2008 (MSVCR90D) 2010 (MSVCR100D) 2012 (MSVCR110D) or the 2013 (MSVCR120D), each dll is provided according to the Visual Studio version.
There are a few ways to solve this:
Check to be sure that you're compiling all the components of your
project in Release mode. If this does not solve the issue continue
to the next steps.
You could solve this locally by installing Visual Studio 2010 on your
machine. This is not what I would recommend, but it would surely
overcome the issue
You could also download the file from this third party website and
copy it to your projects bin:
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d
This option is the LEAST recommended option.
Run dependency Walker and see what file depends on the MSVCR100D.dll
and the try and fix that file in order to break your dependency. You can download depends here: http://www.dependencywalker.com/
Check to be sure that you're project is linking the correct version of
the CRT and any other libraries you may be using (e.g., MFC, ATL,
etc.)
Note: Installing the redistributables alone will NOT solve this problem, since the redistributables only contain the release version of the file MSVCR100.dll (notice no 'D')
Would it be possible that in your project you are somehow using some component/library built with Visual Studio 2010, which requires the MSVCR100D DLL?

LIBCMTD.lib(crt0.lib) LNK 2019 error in project

I've created an OpenGL (GLEW) project in VS2012 and it is working perfectly. Now I've moved the project to VS2013. I've created a new project and set the project's environment the same as I did in VS2012:
Character Set:--------------Use Multi-Byte Character Set
Include Directories:--------C:\Foo\glew-1.9.0\include
Library Directories:--------C:\Foo\glew-1.9.0\lib
Additional Dependences:-opengl32.lib; glu32.lib; glew32.lib
Runtime Libary:-------------Multi-Threaded Debug (/MTd)
All code is exactly the same as before, but when I run the program, I get this error:
Error 1 error LNK2019: unresolved external symbol _main referenced in
function ___tmainCRTStartup c:\FooBar\...\Projects\OpenGL\OpenGL\LIBCMTD.lib(crt0.obj)
OpenGL
I can't see why this same project with the same settings and code doesn't work when it is an exact duplicate.
Hi #SpicyWeenie LIBCMTD is the debug version of the static multi-threaded C runtime library, and according to Microsofts licensing you cannot use than in the release version of code, I would check you are compiling in debug mode:
in debug mode use /MTd as the runtime library
in release mode use /MT as the runtime library
This will hopefully help, if not, then clean your project before building, and if that does not help either, apply liberally with swearing before creating a new project and ensuring it is a Windows Console Application and not a Windows Application (the last one has been the most common cause of the exact error you are describing for me, and happens mostly to me when moving between versions of Visual Studio (2008 to 2010 or 2010 to 2012)
Sincerely hope this helps, but if it doesnt let me know and maybe I can figure out whats wrong:)

Link library developed in old Visual Studio

I am using Visual Studio 2010 but has received an external library developed for Visual Studio 2008. If I try to link the library into my program, I get the following error:
Activation context generation failed for "Tutorial.exe".
Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",
publicKeyToken="1fc8b3b9a1e18e3b",type="win3
Is there any way that I can link the library anyway?
From the error message, it seems that you are linking the debug version of the external library that requires the debug version of VS2008 runtime library. Note that Microsoft do not distribute debug versions of their VC runtime library so either you have to
a) Install VS2008 itself so that it installs both debug and release version of VS2008 runtime library into the system.
OR
b) Install VS2008 re-distributable package and use only the release version of the external library in your project.