I am not familiar with C/C++ but I have to use vsvars32.bat to build an executable file. When I run vsvars32.bat i get some unresolved external symbol errors. I did a little bit of research and it seems that they occur because the lib that contains the definition are not included (Unresolved external symbol in object files).
Here is a one of the error:
libxml2.lib(error.obj) : error LNK2001: unresolved external symbol ___iob_func
I was provided the libxml2.lib file. I'm guessing that I'm getting this error because I need to copy it someplace where vsvars32.bat will look for it. I've been looking through the vsvars32.bat file and it looks like there's three libraries that are defined:
Windows SDK (%WindowsSdkDir%)
NETFXSDK (%NETFXSDKDir%)
UCRTVersion (%UCRTVersion%)
I was able to locate the NETFXSDK library folders on my machine but not the two others. I also noticed that I don't have any system variables named WindowsSdkDir, NETFXSDKDir or UCRTVersion. Is there something else that I should install or run? Am I on the totally wrong track?
Related
I've built a statically linked library from a project which I downloaded from here InfinityHook project
I'm getting the following two (2) errors in Visual Studio 2017 when I reference any of the functions which are available for export.
Error LNK2019 unresolved external symbol IfhInitialize referenced
in function
DriverEntry HelloWorld_Driver C:\Users\MYSELF\Documents\Visual Studio
2017\Projects\HelloWorld_Driver\HelloWorld_Driver\Driver.obj
Error LNK1120 1 unresolved externals
HelloWorld_Driver C:\Users\MYSELF\Documents\Visual Studio
2017\Projects\HelloWorld_Driver\x64\Debug\HelloWorld_Driver.sys
I get the same type of error when I reference another function from the same infinityhook.h header file and which is statically built in the libinfinityhook.lib file. So basically none of the functions that are "exported" are available to be called and are giving linking errors when referenced from the main project. Before arriving at this conclusion I tried several possible solutions found on StackOverflow but none of them have worked. I've added the statically linked file libinfiinityhook.lib in Visual Studio 2017 Configuration Properties->Linker->Input->Additional Dependencies and the file is located in the correct directory on disk so the linker can find it. But I also added the directory path to this library file to the following settings in VS2017 Configuration Properties->Linker->General->Additional Library Directories.
If anyone else is having the same issue the problem was that I was calling the two C++ defined functions, declared as C++ functions from a "C" based module. Recompiled the static library with the keyword extern and all is working as it should.
I am statically building LibSSH on Windows and managed to build it with cmake-gui. If I build the resulting Visual Studio project, I get the ssh.lib file. However, if I link this .lib file to another project where I need it, I receive following errors:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _BN_bn2hex referenced in function _ssh_print_bignum Project1 C:\Users\User\Desktop\Project1\Project1\ssh.lib(bignum.obj) 1
Error LNK2019 unresolved external symbol _DH_new referenced in function _ssh_dh_set_parameters Project1 C:\Users\User\Desktop\Project1\Project1\ssh.lib(dh_crypto.obj) 1
Error LNK2019 unresolved external symbol _DH_free referenced in function _ssh_dh_cleanup Project1 C:\Users\User\Desktop\Project1\Project1\ssh.lib(dh_crypto.obj) 1
And like ~250 more of these.
I found these object files on my system in another directory of the LibSSH project, but don't know what to do with these.
Can anybody help me with this problem?
When building my application in Debug mode: The build works. The application works.
When building my application in Release mode, I get the following error message
error LNK2019: unresolved external symbol __imp__GetClassNameA#12 referenced in function _eachWindow#8
All implementation files of my application have a .c extension; that however doesn't mean I would know which compiler is used by visual studio.
From the documentation of GetClassNameA I can see that a library User32.lib is required. I have found a library with that name in
C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib>
I have added that directory to the property pages:
Configuration Properties > Linker > General > Additional Library
Directories
but that did not help. I am still receiving that error message.
Thanks for help. I know this question has been asked before, but the previous answers did not help me.
Please help in baby steps, I am still overwhelmed by Windows programming.
Does _eachWindow call GetClassName? Then you need to link user32.lib. Check the additional dependencies in the project's linker settings, not the additional library directories.
– dxiv
dxiv's comment … makes the application work. – chris j
I am getting errors of the following type :
1>authenticate.obj : error LNK2001: unresolved external symbol _ldap_first_attribute#12
1>authenticate.obj : error LNK2001: unresolved external symbol _ldap_first_attribute#12
1>authenticate.obj : error LNK2001: unresolved external symbol _ldap_value_free#4
1>authenticate.obj : error LNK2001: unresolved external symbol _ldap_err2string#4
I have already added the header file folder to Project -> Properties->C/C++->General->Additional Include Directories.
Any ideas
This is a linker error. You need to provide the library where the _ldap_first_attribute and other functions listed can be found. This can be either a .lib static library or a .dll dynamic library
If this refers to this function then you have to add Wldap32.lib to Linker->Input->Additional Dependencies
edit:
if this is a external library, you don't have the lib and cannot rebuild the library yourself you can either create one or use explicit linking
You are missing LDAP lib.Try to configure your project correctly which points to include folder where LDAP.lib is present.
Linker --> Input --> Additional Dependencies will surely help.
I have been reading error LNK2019 for ZLib sample code compiling - But was unable to solve the problem regarding the linking errors.
I downloaded the latest version from zlib.org and assured to inlcude the lib files to my lib folder and include files to my include folder.
However i get something like this:
Tmain.obj : error LNK2019: unresolved external symbol _inflate referenced in function _inf
z_stream strm;
[...]
ret = inflateInit(&strm);
This is from the zpipe.c file, which is one of their test files, so it should compile, but every time it want to call the inflate and deflate functions, it get this linker error, (like on the other question).
I have been trying to resolve it with some of my group members, and we haven't been able to resolve it yet. We are 100% sure that the libraries are correctly placed.
We are 100% sure that the libraries are correctly placed
Getting that wrong would produce a different error. Just putting the .lib file in a directory isn't enough, you also have to tell the linker to link the .lib file. Project + Properties, Linker, Input, Additional Dependencies.
If that doesn't help then document your question better. Post a link to the specific download you used and copy your test project to a file sharing service.