LINK : fatal error LNK1104: cannot open file “Iphlpapi.lib”
-
02-10-2019 - |
Pergunta
So I'm using Visual C++ 6.0, and trying to compile some source code, but upon compilation I get this:
Linking...
LINK : fatal error LNK1104: cannot open file "Iphlpapi.lib"
Error executing link.exe.
I'm using the correct SDK, and the directories are correct. I've checked, double checked, and triple checked. The file is the specified directory. I can't figure out what the problem is. Any ideas?
Service Pack 6
SDK for Windows Server 2003 SP1 //Sounds odd, since I'm running XP SP3, but this has worked for me in the past.
Like I've said, it worked in the past for me, flawlessly. I don't understand why it won't work now.
Solução
I'm sure that you have some problems with your project configuration. Try moving that file to the folder with your source code. Check the way you add
it (via input libraries) to your project. Try creating a new project and moving that .lib into your code folder (after adding it to used libraries).
Outras dicas
sysinternals procmon will show you where the build is looking. wont fix it but will give you a clue
(tools)
(options)
(directories) tab
(show directories for ) library files
In general, you want the path that includes the missing library to be included there. so that all projects can find it.
The other option would be to add the library to your project using
(right click on the project)
(add files to project)
browse to, and add the library
One of those two methods should do the job for you
compile using command prompt, Check the syntax, are the white spaces correctly placed e.g "cl practice.cpp /clr:safe /doc" is executed properly but "cl practice.cpp/clr:safe/doc" produces the error u mentioned
Maybe am very late to this discussion, the following solution worked for me. The only setting required was to include the path to the library.
In VC++ 6.0, go to Tools -> Options -> Directories tab -> Select "LibraryFiles option" under "ShowDirectories" dropdown.
Add the path to the library, in my case the path is "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"