Once again including library and Error LNK2001: unresolved external symbol - c++

I have a problem with Visual Studio 2013 and Error LNK2001.
I tried to linking Zbar Library - I have downloaded, instaled and linked this library
I tried to run this simple program:
#include "zbar.h"
using namespace zbar;
int main()
{
ImageScanner scanner;
return 0;
}
I can compile this, but can't build it.
I can see this:
Error 1 error LNK2001: unresolved external symbol zbar_image_scanner_destroy C:\Users\n\Documents\nn\ZBar_detektor\Opencv_projekt\main.obj Opencv_projekt
Error 2 error LNK2001: unresolved external symbol zbar_image_scanner_create C:\Users\n\Documents\nn\ZBar_detektor\Opencv_projekt\main.obj Opencv_projekt
I know that except include directory, I have to link lib files
I did it this way:
Except that, I copy everything from /bin directory, and paste it to /Windows/System
In some cases, in the past this operation helped, but not this time - still can see Error LNK2001
Any clues or advices? Help please
Best regards, Fidor

In general: Thanks you! Zbar include sample VS project, but it required strange additional libraries. But that gave me a solution: Problem was, that my project was x64, and zbar are x32, and need kernel32.dll. When I changed my project configuration ewerything started work

Related

Installing Glog linking error

I am new to programming. I want to install Glog on my Windows 10 system. I have followed the instructions found in a Stack Overflow thread with the same name.
I used cmake and Visual Studio 2015 to build the project.
First anomaly of the built file: I noticed that in the glog directory the header file "log_severity.h" was missing. To alleviate this problem, I copied the "log_severity.h" from the GitHub repository and pasted it.
http://imgur.com/QeLTnat
I then created a sample program that just initializes the logger by only using
google::InitGoogleLogging(argv[0]);
in the main.
Before compiling I direct the linker to include an additional include directory. This include directory is the one with the header files as in the second image (with the log_severity.h etc.):
http://imgur.com/yrjOIot
Yet I still receive a linking error when compiling the code:
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl google::InitGoogleLogging(char const *)" (__imp_?InitGoogleLogging#google##YAXPEBD#Z) referenced in function main
1>D:\Documents\Programming\C++\Programme\GLogTest\GlogTest\x64\Debug\GlogTest.exe : fatal error LNK1120: 1 unresolved externals
What am I doing wrong?
Thanks a lot of any answers.
I solved it. When you build the project in visual studio, there is also an "Installation" folder inside the MS project. I forgot to build that as well!

error LNK2019 unresolved external symbol when trying to link dll

I know many people have asked about this error and trust me I've read ALL of them and followed all the steps! But I'm still getting the unresolved external symbol error.
I'm trying to use the dll of lp_solve (a linear programming package) in my c++ code in visual studio 2012.
The error message I'm getting is:
Error 80 error LNK2019: unresolved external symbol _make_lp#8 referenced in function "void __cdecl my_solve(BLAH BLAH)
The function make_lp() is from the lp_solve package and I'm calling it from my_solve() in my code. This error message pops up for each solver function I call. Seems the linker just couldn't find any of the implementation of these functions.
I've done the following
put #include "lp_lib.h" in my source code
put the .dll, .h and .lib files from the lp_solve package in the working directory and
added the path under Linker:General:Additional Library Directories.
added the lib under Linker:Input:Additional dependency
What's wrong?
Thanks for your help!
The problem I had was solved after realizing I downloaded the WIN64 package for lp_solve but my visual studio is using WIN32 as build platform (even though my machine is x86_64).
Using extern "C" may be helpful while including lp_lib.h in your .cpp as follows:
extern "C"
{
#include "lp_lib.h"
}
For more information, please check this link:
http://www.geeksforgeeks.org/extern-c-in-c/

C++ cURL linking error "unresolved external symbol _curl_easy_"

I am facing issues with the C++ cUrl Library on Windows, using Visual Studio 2012.
I have a CGI project which generates a .cgi file. This project includes another project called Library which is a Static Library Project.
In the Library project, I have the code which uses cUrl and includes curl/curl.h. I have referenced the Preprocessor Definition CURL_STATICLIB.
Then in my CGI Project, I have linked libcurl.lib to my project in Configuration Properties > Linker > Additional Dependencies.
But when I try to build the Solution, I still have those errors :
error LNK2001: unresolved external symbol _curl_easy_setopt in Library.lib(fct_util.obj)
error LNK2001: unresolved external symbol _curl_easy_perform in Library.lib(fct_util.obj)
error LNK2001: unresolved external symbol _curl_easy_init in Library.lib(fct_util.obj)
error LNK2001: unresolved external symbol _curl_easy_cleanup in Library.lib(fct_util.obj)
I already took a look at this topic : Unresolved symbols when linking a program using libcurl, as well as other related topics but couldn't find a solution for my problem.
Am I missing something ?
Kind Regards.
Credit to this guy helped me get further than any docs.
Still have a couple more issues.
https://www.youtube.com/watch?v=wjNyT5PhNvI
Then do this , someone in the video comments
Very important after you do everything in video.
Need to navigate back to solution right click properties
(see below comment)
"Thanks , it worked after i added Normaliz.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;advapi32.lib in Additional Dependencies(property->linker->input)"

Unresolved external symbol - IdnToAscii

I tried to build the following sample application available on msdn:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319089%28v=vs.85%29.aspx
I created a new C++ command line project in Visual Studio 2012 Premium on a windows 7 64bit box, and copied the code of the sample in the main cpp file.
When I try to compile, I get the following error:
Error 1 error LNK2001: unresolved external symbol __imp__IdnToAscii#20
From other posts of people having similar errors, I figure I'm supposed to include some header or lib file. But which one(s)? How do I do that in VS2012/C++ (I'm a complete c++ noob...)
It seems from MSDN, you need to link against Normaliz.dll.
Try adding Normaliz.lib in Linker -> Input -> Additional Dependencies

Why am I getting error LNK2001 when linking to zlib.lib?

I'm working on a project that already contains the gzip library as follows:
zlib\zlib.h
zlib\zlib.lib
zlib\zconf.h
I would like to use the gzip functions from this .lib but am getting the following errors:
Compress.cpp
Linking...
Compress.obj : error LNK2001: unresolved external symbol _gzclose
Compress.obj : error LNK2001: unresolved external symbol _gzerror
Compress.obj : error LNK2001: unresolved external symbol _gzwrite
Compress.obj : error LNK2001: unresolved external symbol _gzopen
.\Debug/files.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
The link settings include:
Object/library modules: zlib.lib
Project Options:
zlib.lib
In the file using the gzX() functions, it
#include "zlib/zlib.h"
What else needs to be done here to use these functions?
Thank You.
EDIT: Using Visual Studio 6.0 C++
EDIT2: It turned out the static library I was using had the gz() functions taken out of them. The header file still had them which was misleading.
I grabbed the one off here to get zlib to build in windows. If you did the same, you may have forgotten to #define ZLIB_WINAPI before including zlib.h
you also need to add zlib.lib to your project's libraries:
Project properties->Linker->Input->Additional Dependencies.
When the build stops, ctrl-click on the URL to see the more verbose form of the log and check the actual command line passed to the linker. That at least will tell you whether the option to link against zlib is being respected. You may get other useful diagnostic output. One possibility could be that the architecture is different (eg you're building x64 but the lib is x86)
It turned out the static library I was using had the gz() functions taken out of them. The header file still had them which was misleading.