Unresolved external symbol for imp_fputws, imp_towupper in visual studio - c++

I am developing windows program, and got link error :
error LNK2001: unresolved external symbol __imp__wcsicmp
error LNK2001: unresolved external symbol __imp_fputws
error LNK2001: unresolved external symbol __imp_towupper
It seems like I need wide char version fputs() and toupper(), but I can't find it.
Could someone provide the library name or compile settings that will resolve the link error?
Environment : Win server 2008 + visual studio 2010 pro + WinDDK 7600.16385.1

Not sure if it was the case for you, but I was using the (lib file) meant for a MD runtime execution instead of a MT runtime execution.
Using the correct lib in:
Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
helped me fix the issue

Related

unresolved external symbol inflateEnd (and others) while using boost Zlib

I'm in the process of converting 32bit project to x64. In most cases it just means appending 64 to library paths (and eventually building those libraries for x64). Now I assume all libraries are already ready and the code is also x64 compatible. But I keep getting errors for boost zlib library, like these:
error LNK2019: unresolved external symbol inflateEnd
error LNK2019: unresolved external symbol inflate
error LNK2019: unresolved external symbol inflateInit_
error LNK2019: unresolved external symbol deflateEnd
error LNK2019: unresolved external symbol deflate
error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_compression"
error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::deflated"
error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_strategy"
I enabled verbose mode for linker (in MS Visual Studio you do this by adding /VERBOSE:LIB to additional linker options). Thanks to that, I can see this output line:
Searching .\..\..\libs\boost145\stage\lib64\libboost_zlib-vc100-mt-gd-1_45.lib
That would imply that the library was found in the boost145\stage\lib64. So what should I be looking for now?
One strange thing is that file that defines the first group of missing symbols (those that are not within boost) has header files within the project, zlib.h and zconf.h. Maybe this is some hint? The zlib.h defines external symbols as:
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
Obvious question is: where the hell is lib file for this header file?
I had the same issue, to resolve the errors I download the source from zlib and built the x64 dlls/libs locally. There were a couple issues with solution file downloaded, fixes are described below.
Zlib 1.2.8 source code: http://zlib.net/zlib128.zip
Solution File for VS2012 is located at: zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln
Fixes:
Change:
<Command>cd ..\..\..\contrib\masmx64
bld_ml64.bat</Command>
to:
<Command>cd ..\..\contrib\masmx64
bld_ml64.bat</Command>
In zlibvc project properties -> Linker -> Advanced -> Image Has Safe Exception Handlers -> set to No (/SAFESEH:NO). Info about SAFESEH: Compiling libffi with VS2012 fails with fatal error LNK1281: Unable to generate SAFESEH image

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 symbols in C++ project

This is my situation (I am very new to C++ MFC coding and I am trying to debug an existing application project)
I use this line in my code (in a visual studio 2012 MFC project)
CoCreateInstance(CLSID_PortableDeviceValues, NULL,
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&x));
While I run the project, i get a linker error like this
error LNK2001: unresolved external symbol _CLSID_PortableDeviceValues
This happens for all the CLSID values that I am referring to in the code. Like this
error LNK2001: unresolved external symbol
_CLSID_PortableDeviceKeyCollection
error LNK2001: unresolved external symbol _IID_IPortableDeviceEventCallback
error LNK2001: unresolved external symbol _CLSID_PortableDeviceManager
error LNK2001: unresolved external symbol _CLSID_PortableDeviceServiceFTM
I checked for the declaration of "CLSID_PortableDeviceValues" and it was found in "PortableDeviceTypes.h" and I have imported that library as well.
I do not get any compiler error, but run into the linker errors mentioned above..
Can someone please help me out here. I could not resolve this ..
You will need to add PortableDeviceGUIDs.lib to your project.
(Look up the section "Requirements" in the MSDN documentation for IPortableDeviceValues)
When the linker builds your project, it is looking for the implementation data that is behind the identifier CLSID_PortableDeviceValues. This data is in the library PortableDeviceGUIDs.lib, and the linker has to be told to use this library.
The header file you included in your source code only declares the symbol "CLSID_PortableDeviceValues", without importing its implementation.

Linker errors while migrating from x32 to x64

I have recently migrated a project from x32 to x64 in VS professional 2008 and I'm getting this weird linker errors:
error LNK2001: unresolved external symbol __imp_PostMessageW
error LNK2001: unresolved external symbol __imp_FlushFileBuffers
error LNK2001: unresolved external symbol __imp_WriteFile
error LNK2001: unresolved external symbol __imp_WaitForSingleObject
error LNK2001: unresolved external symbol __imp_SetFilePointer
error LNK2001: unresolved external symbol __imp_EnterCriticalSection
...
And more of this nature.
I am including shlwapi.lib in the linker.
Running on Windows 7 x64.
Additional Dependencies:
The solution for my problem was setting Linker > General > Additional Library Directories with "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64" instead of "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib".
Ensure that the x64 configuration is selected. Right-click your project in the Solution Explorer window, Properties, Linker, Input. Click on the Additional Dependencies box and click the button that appears.
This is what it should look like if the project is configured correctly. Note how the "Inherit" checkbox is ticked and how the inherited values list the standard SDK libraries. Like kernel32.lib, the link library that has the definition for __imp_FlushFileBuffers, etc. If it doesn't look like this in your project then you'll get these linker errors.

WMI Linker Error on x64

I'm trying to use the WMI example from msdn:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384724%28v=vs.85%29.aspx
I've copied the last set of code there verbatim into a console application in VS2008. If I have the application in release or debug for the win32 platform, it compiles (and runs) fine. If I have it in release or debug for the x64 platform, I get the following linker errors:
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemConfigureRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemLocator
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemLocator
fatal error LNK1120: 5 unresolved externals
I've already tried putting the wbemuuid.lib into the linker input directly in the project properties, but that didn't make a difference from the pragma.
Has anybody made this work with x64? Or is there something else I'm doing wrong?
I give credit to RRUZ for this, as he/she at least put me on the right track, but as they haven't posted an answer-answer (just a comment) I can't click them for credit.
Basically, because of the work environment I'm in, the project directories are set up in a "non-standard" way. There was already a copy of wbemuuid.lib in another directory that was not the correct version (not x64), and that directory was higher on the library include list, thus never getting to the right Windows Platform library directory.
So if you ever have problems with x86 vs x64 and library includes, check your directories and check the ORDER of them as well.