How to solve LNK2019 unresolved external __imp____iob_func - visual-studio-2019

Attempt to link with Visual Studio 2019 an old Visual Studio 2008 x86 project using Gsl library v1.13, I got this error on link step:
LNK2019 symbole externe non résolu __imp____iob_func référencé dans la fonction _gsl_error
Options are same from Visual Studio 2008 project and already tried these points in this link :
unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2
If someone has idea and can help?
Thank you

__iob and __printf are symbols contained in the stdio library.
It seems to me that the standard libc library is not statically linked to your new executable.
Try to this:
Configure the new project to statically link the libc library

The constitution of the project is:
Main Executable (AA)
refers to intermediate static lib (BB)
refers to gsl v1.13 static lib build ten years ago it seems (CC)
https://ftp.igh.cnrs.fr/pub/gnu/gsl/
I may be looking for the option to statically link the main executable (AA) with the standard libc library under Visual Studio 2019 but can't find accurate information out of this https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160.
Just so as not to mislead my protagonist to link statically, can you confirm to me that it is necessary to link with the standard library (AA) , (BB) or (CC) ?

Related

Why will OpenCV work in a Visual Studio C++ Console Application but not a Universal Windows Platform application?

I am currently working on a Universal Windows Platform (C++/Cx) in Visual Studio Enterprise 2019 16.10.3. Part of this project requires the use of OpenCV to generate an image. I implemented this in a C++ console application and was able to get it working perfectly. Using this tutorial as a guide, I downloaded and installed OpenCV 4.5.2 for Windows and configured it within my console application via the Visual Studio project properties.
Everything worked correctly until I moved the code into my UWP project. I copied the exact same settings for OpenCV from my console application into this UWP project, but when running it on Debug x64, I am receiving an "Unable to activate Windows Store app...'The target process aborted before activation completed." error when I try to run it. In the Debug console, it states that "A dependent dll was not found" but does not specify what DLL anywhere. If I run it on Debug x86, I get four LNK2019 errors that look like this, in addition to a warning about OpenCV being an x64 library but being ran in an x86 application:
unresolved external symbol "void __cdecl cv::error(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,char const *,int)" (?error#cv##YAXHABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PBD1H#Z) referenced in function "public: class cv::Vec<unsigned char,3> & __thiscall cv::Mat::at<class cv::Vec<unsigned char,3> >(class cv::Point_<int>)" (??$at#V?$Vec#E$02#cv###Mat#cv##QAEAAV?$Vec#E$02#1#V?$Point_#H#1##Z)
In short, I am using the exact same code and project settings for OpenCV between the two projects, and it works in a console application but not a UWP application. I have tried to use an OpenCV package installed through NuGet instead, but it throws 11 errors similar to the one above. Does anyone know what may be wrong? Visual Studio is able to read the OpenCV library because the header files I am using appear under the External Dependencies folder in my Solution Explorer.
I am open to using a different method of OpenCV installation if that will work better, or even an alterative to OpenCV entirely if necessary.

Visual Studio 2019, Win10, and HDF5 installed using vcpkg. Unresolved external symbol H5T_IEEE_F64BE_g

Any help is much appreciated. I'm having link errors when trying to use HDF5 libraries installed using vcpkg with Visual Studio 2019 on Windows 10.
I installed HDF5 1.12.0 on Windows 10 using vcpkg:
PowerShell: .\vcpkg install hdf5 hdf5:x64-windows
I then attempted to use Visual Studio 2019 to build my project that uses HDF5, but I keep getting the following LNK2001 errors.
unresolved external symbol H5T_IEEE_F64BE_g
unresolved external symbol H5T_STD_I64BE_g
unresolved external symbol H5T_C_S1_g
unresolved external symbol H5T_NATIVE_INT_g
unresolved external symbol H5T_NATIVE_DOUBLE_g
I tried to solve this by directly adding the additional library directories that are under the vcpkg/packages/ for HDF5, SZIP, and ZLIB, that were automatically installed as part of the HDF5 installation step given previously, and I also added the library files to the additional dependencies in the order prescribed by the HDF5 documentation:
hdf5_hl.lib
hdf5.lib
szip.lib
zlib.lib
But I still have the unresolved external symbol errors.
All those symbols are prefixed with H5_DLLVAR. As such you need to explicitly set the preprocessor definitionH5_BUILT_AS_DYNAMIC_LIBif you are not using CMake and only the MSBuild integration vcpkg provides. You could also open and issue with vcpkg since it should embedded that definition into the correct hdf5 header if the library is built dynamically.
The vcpkg command that I used installs the dynamic version of the libraries. Instead I installed the static version of the libraries using:
./vcpkg install hdf5:x64-windows-static
No manual inclusion of the library directories or libraries themselves is needed. Just be sure to run this command as well (when first installing vcpkg):
./vcpkg.exe integrate install
Once that was done, Visual Studio 2019 was able to properly use the HDF5 libraries for my project and the linker error was gone (binary produced).
Hope this helps someone in the future!

LNK2019 LNK2001 errors in visual studio 2017

I am using Visual Studio 2017, and building in x64. I have 2 libraries linked to my solution file, flann, and opencv. I can build the release mode but in debug mode everything is messed up! The problem is with opencv library, and I have double checked the library directories, everything seems to be correct! What am I doing wrong then?!
Here is one of the errors I am getting:
LNK2001 unresolved external symbol "private: void __cdecl cv::String::deallocate(void)" (?deallocate#String#cv##AEAAXXZ)
Found the problem! under solution --> properties --> C/C++ --> Preprocessor --> Preprocessor Definition: I had WIN32 as one of the definition while building in X64! Removing that fixed my problem!

Delphi 2007 Import a Type Library

In Delphi 2007 i'm trying to Import a type library and i get an error message:
error occured during loading library type/DLL.
I want to import libraries: pkcs11.dll, libp11.dll
The libraries have been prepared in VisualStudio 2017.
I tried to use command-line tool tlibimp, but without effects.
c:\Program Files (x86)\CodeGear\RAD Studio\5.0\Projects\TEST>tlibimp -p pkcs11.dll
Borland TLIBIMP Version 11.0
Copyright (c) 1997-2005 Borland Software Corporation
Error loading type library pkcs11.dll.
Maybe someone knows how to solve this problem?
I tried to do regsvr32 pkcs11.dll but i get the message: DllRegisterServer entry point was not found.
I also tried to find pkcs11.tlb in VS project but it does not exist.
I installed the Dependency Walker "depends.exe" and saw that some libraries are missing:
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
I have installed Visual Studio 2017 and why are not there ? Where to get them ?
As Eugene explained, PKCS#11 API doesn't export any type libraries and i need to import function. I found 2 tools:
1. 23991_c_to_pascal_converter_1.0 from Embarcadero
2. GUIHeadConv from Dr. Bob

How to install OpenCV 3.1 with nonfree module?

I'm trying to write a program that uses SURF algorithm and I know that the nonfree module must be installed separately. I've downloaded and installed the latest version of CMake(3.5.2) and I'm following the instructions from:
https://github.com/itseez/opencv_contrib/ . I'm using the GUI and I run Visual Studio 2015 on a 64 bit Windows 10.
Since I know that for SURF you must include xfeatures2d when it asked me the source of the code I only specified the xfeatures2d folder. When I first pressed the configure button I had some errors(I've attached an image of them). I managed to get rid of one of the errors, the one that said to write a line of code at the top of the file
cmake_minimum_required(VERSION 3.5), but I still have one error:
CMake Error at CMakeLists.txt:4 (ocv_define_module):
Unknown CMake command "ocv_define_module".
I'm also attaching a picture of the CMakeLists.txt. Please help me find the problem.
Also, if you could help my install all modules at once, I would be grateful. Or do I have to set as input every folder in the modules folder?
GUI error and CMakeLists.txt
Try using Visual Studio 12 2013 for compilation, this has worked for me, but not the other (newer) versions of Visual Studio.

Resources