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.
Related
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
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
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)"
I've tried and tried to compile source from the site listed. Specifically the second one involving a triangle. So here's a list of my lib includes:
opengl32.lib
glfw3.lib
glu32.lib
glfw3dll.lib
glew32.lib
glew32s.lib
freeglut.lib
I'm on windows 7 x64, IDE is VS2010 express C++ registered, all my includes and libs are for x86, here are my errors. I did get CMake to make the project files for me and then I got the tutorials to build too.
1>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__TrackMouseEvent#4
1>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__TranslateMessage#4
1>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__DispatchMessageW#4
1>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__PeekMessageW#20
1>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__GetMessageTime#0
There's like 50 more like that too. They all start with the glfw3.lib too. Makes me think I didn't have the right library files there but I've tried every lib file I've got, tried the binarys prebuilt for windows and everything. The includes for the project file from the tutorial websites are as follows:
// these are already included by VS 2010.
kernel32.lib //
user32.lib//
gdi32.lib//
winspool.lib//
shell32.lib//
ole32.lib//
oleaut32.lib//
uuid.lib//
comdlg32.lib//
advapi32.lib//
glu32.lib
opengl32.lib
external\glfw-3.0.3\src\Release\glfw3.lib
external\Release\GLEW_190.lib
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.