I am getting below error while migrating my project from VS2008 to VS2015.
21>TFCLd.lib(cryptlib.obj) : warning LNK4217: locally defined symbol _fprintf imported in function _OpenSSLDie
21>TFCLd.lib(rsa_sign.obj) : warning LNK4049: locally defined symbol _fprintf imported
21>TFCLd.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _OpenSSLDie
21>TFCLd.lib(rsa_sign.obj) : error LNK2001: unresolved external symbol __imp____iob_func
The project builds in VS2008 but with above error in VS2015. May I know what am I missing.
Put this in the begin of your class header file or in stdafx.h
FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
Have a look at:
http://openssl.6102.n7.nabble.com/Compiling-OpenSSl-Project-with-Visual-Studio-2015-td59416.html
Changing line 310 of the file e_os.h in the openssl root directory from
# if _MSC_VER> =1300
to # if _MSC_VER> =1300 && _MSC_VER <= 1800
fixes the problem.
The original poster describes the cause of the problem:
In the Visual Studio 2015 the libraries with old names were redesigned
Visual Studio 2015 is referred to as _MSC_VER == 1900.
Be sure your libcurl.lib was compiled with the same IDE (MSVC 2015) as your application.
Your openSSL version is outdated for VS2015. Download and install latest stable version from https://www.openssl.org/source/
Edit: How to install it: https://www.youtube.com/watch?v=icNn-eJif9k
Generally speaking, click on the project in the Solution Explorer, and go-->Properties-->C/C++-->Code Generation-->Runtime Library. Make the libraries and binary all the same option.
Related
This is my code in Visual Studio C++
#include "stdafx.h"
#include<opencv\cv.h>
#include<opencv\highgui.h>
using namespace cv;
int main(int argc, char** argv[]) {
IplImage* img = cvLoadImage("logo.jpg");
cvNamedWindow("Test", CV_WINDOW_AUTOSIZE);
cvShowImage("Test", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Test");
return 0;
}
I am using OpenCV 2.4.6 and Visual Studio 2010. This is the error:
openCV_testing.obj : error LNK2019: unresolved external symbol _cvDestroyWindow
referenced in function _main
openCV_testing.obj : error LNK2019: unresolved external symbol _cvReleaseImage
referenced in function _main
openCV_testing.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in
function _main
openCV_testing.obj : error LNK2019: unresolved external symbol _cvShowImage referenced
in function _main
openCV_testing.obj : error LNK2019: unresolved external symbol _cvNamedWindow
referenced in function _main
openCV_testing.obj : error LNK2019: unresolved external symbol _cvLoadImage referenced
in function _main
Please help.
'unresolved external symbol' means that you're not linking with required library.
Go to Properties -> Linker -> Additional Library dependencies and add path to OpenCV libs.
First check
How to build applications with OpenCV inside the Microsoft Visual Studio
If you still suffer from the same problem, you could be under one of the below cases.
Your active solution platform is x86 but you are trying to link x64 OpenCV libraries.
Your active solution platform is X64 but you are trying to link x86 OpenCV libraries.
If you are under one of these cases, check
Compiling a 64-bit Application in Microsoft Visual Studio Express 2010
Add these into your code:
#pragma comment (lib, "opencv_core248d.lib")
#pragma comment (lib, "opencv_highgui248d.lib")
#pragma comment (lib, "opencv_imgproc248d.lib")
#pragma comment (lib, "opencv_video248d.lib")
#pragma comment (lib, "opencv_features2d248d.lib")
It worked for me.
i searched a lot for the same problem this was the best solution i had found and it worked for me.
Open Configuration Properties > C/C++ > General, and edit the field Additional Include Directories to add these 3 paths (for the headers):
C:\OpenCV2.3\build\include\opencv
C:\OpenCV2.3\build\include\opencv2
C:\OpenCV2.3\build\include
I know this is not about the OpenCV library, but I already had a problem importing Tiny-Process library. My .lib file was linked correctly in Configuration Properties -> Linker -> Additional Library dependencies and the Additionnal Include Directories were correctly added but the the functions definition (s) were still not found and I was getting the LNK2019 error.
To fix the issue, I had to go in the library project properties, change the Character Set property in Configuration Properties -> Advanced Character Set and change the value Use Multi-Byte Character Set to Use Unicode Character Set.
After recompiling the library and using the new .lib file, it was working.
I am trying to built a .cpp file using OpenNI in Visual Studio 2012. I am using the code of the SimpleViewer sample (it is included in the OpenNI). When I try to build the .cpp file I got the error LNK2019 which it seems a problem when the compiler has to link the OpenNI library. What could be wrong?
Errors (55 in total):
> Error 1 error LNK2019: unresolved external symbol __imp__oniShutdown
> referenced in function "public: static void __cdecl
> openni::OpenNI::shutdown(void)"
> (?shutdown#OpenNI#openni##SAXXZ) C:\Develop\VisualStudioWorkspace\Projects\My
> programs\OpenNI2_test\OpenNI2_test\Viewer.obj OpenNI2_test
Error 2 error LNK2019: unresolved external symbol __imp__oniWaitForAnyStream referenced in function "public: static enum openni::Status __cdecl openni::OpenNI::waitForAnyStream(class openni::VideoStream * *,int,int *,int)" (?waitForAnyStream#OpenNI#openni##SA?AW4Status#2#PAPAVVideoStream#2#HPAHH#Z) C:\Develop\VisualStudioWorkspace\Projects\My programs\OpenNI2_test\OpenNI2_test\Viewer.obj OpenNI2_test
I followed all the steps described in the OpenNI website to compile a file in Visual Studio: I added all the VCC Directories and the Include and Lib environment variables. I also added OpenNI2.lib in the additional dependencies on the Linker section. I also copied the Redist files in the working directory (the directory where I have the .vcproj).
I ran into a similar issue. The sample projects wouldn't build because I was using OpenNI for x64 but the platform was set to Win32. Changing to x64 (in the properties dialog at the top) fixed it for me.
OpenNI 2.0 is not mature enough. Most of the libraries, open source codes, examples and wrappers still use OpenNI 1.5. The integration is not easy since OpenNI2 uses the Microsoft official drivers and OpenNI1.x uses the open source drivers. The 32bit version gives less problems than the 64bits but I ended up installing and working the OpenNI 1.5 and the Kinect non-official drivers.
The problem is related to the linking process. You may have wrong link path in the properties of your projects. There is solution, check this question
maybe it works in your case!
I'm having trouble to compile VTK 5.10.1 example code in Visual Studio 2010 on Windows 7 64 bit SP1.
First of all, I installed VTK using this tutorial.
No errors occured while installing VTK and the example executables like cone.exe located at C:\VTK5.10.1_cmake\bin\Release are running just fine.
In Visual Studio 2010 I started a new Win32 console application and tested the first example code from this site.
I edited the projekt properties (additional include directories, additional Library directories and additional dependencies).
The linker errors looked like that:
vtktest.obj : error LNK2019: unresolved external symbol ""public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (?AddActor#vtkRenderer##QAEXPAVvtkProp###Z)" referenced in function "_main".
Most of the the other people with the same error forgot to add the libs to the additional dependencies.
However I added all libs in the C:\VTK5.10.1_bin\lib\vtk-5.10 directory and the opengl32 library. I tried to seperate the libs by a space, a semicolon and a new line.
Then, I read that people are using the shared libraries. I'm not really familiar with dlls. I reinstalled VTK
with shared libraries options turned on and copied the resulting dlls to the System32 directory.
Now, the errors looks slightly different:
vtktest.obj : error LNK2019: unresolved external symbol ""__declspec(dllimport) public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (__imp_?AddActor#vtkRenderer##QAEXPAVvtkProp###Z)" referenced in function "_main".
Any help would be appriciated!
Nevermind, forgot to change the platform to x64 :/
I've been attempting to install glew and freeglut to use with Visual Studio 2010. I followed this guide and have backtracked a few times to make sure I followed it correctly but I still get the following errors when I try and compile the example code at the end:
Error 1 error LNK2019: unresolved external symbol _imp_glutMainLoop#0 referenced in function _main c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 2 error LNK2019: unresolved external symbol _imp_glutDisplayFunc#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 3 error LNK2019: unresolved external symbol _imp_glutReshapeFunc#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 4 error LNK2019: unresolved external symbol _imp_glutInitDisplayMode#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
and more just like those. I don't know if its a problem but originally I accidentally grabbed the 64bit version. I realized my mistake and overwrote the files with the 32bit versions, then cleaned and attempted the build again with the same result.
Are you sure that you have done "Step 6: Project Settings (Linker)" in linked guide correctly? It seems that the linker is unable to find symbols that are defined in those libraries (glew and glut32.lib). Also make sure that the Visual Studio knows where to find those libraries (Project->Properties->Configuration properties->VC++ Directories->Library Directories).
All the unresolved external symbols should be found in freeglut.lib. Are you sure that you are properly linking to this library?
Instead of trying to accomplish this in the you could just insert the following line of code in one of your header files:
#pragma comment(lib, "freeglut.lib")
I had this problem too. It turns out I was using the express version of visual studios, so I had to download microsoft sdk to get 64bit openGL libraries. Basically, I found this guide more helpful: http://www.cs.uregina.ca/Links/class-info/315/WWW/Lab1/GLUT/windows.html
In visual studio 2008, I have created a static dll called test_static.dll. I am trying to call this from one application. I have included this dll in source files folder and the header file related to it in headers folder. When i am running the application I am getting following liking error. Please give me a solution.
error LNK2019: unresolved external
symbol "struct morph_output * __cdecl
morpho_data(struct morph_input *)"
(?morpho_data##YAPAUmorph_output##PAUmorph_input###Z)
referenced in function _wmain
1>D:\test_app\Debug\test_app.exe :
fatal error LNK1120: 1 unresolved
externals 1>Build log was saved at
"file://d:\test_app\test_app\Debug\BuildLog.htm"
Here test_app is application that is using static dll. and morpho_data is the dll function which is taking input as structure and returning another structure.
When compiling the dll you need to create an import library - a .lib file (Linker->Advanced->Import Library) and include it into the list of libraries your .exe depends on (Linker->Input->Additional Dependencies and Linker->General->Additional Library Directories).
Did you add test_static.lib as input to the linker in the project settings?
Did you include the header file where the function is declared ?