Fatal error LNK1104: cannot open file 'gdi32.lib'

Every time I try to run my code, I get this ERROR, I tried everything by installing the SDK .. but still the same ERROR.

1>------ Build started: Project: ConsoleApplication6, Configuration: Debug Win32 ------ 1>LINK : fatal error LNK1104: cannot open file 'gdi32.lib' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

I am using Windows 7 and VS2012.

+20
c ++ visual-studio visual-studio-2012
Nov 08 '15 at 10:24
source share
7 answers

If anyone has this problem in Visual Studio 2017, this is a problem with updating Windows 10 developers.

The workaround is to select the "Windows 10 SDK (10.0.15063.0) for the C ++ x86 and x64 desktop" in the "Desktop development with C ++" section in the Visual Studio installer.

https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#KINativeDesktopWorkload

+50
Apr 17 '17 at 17:48 on
source share

For those who have the same problem with Visual Studio 2015 on Windows 10, this may be due to the installation being broken. If so, just run the installer to perform Repair.

It might also be nice to install Visual Studio 2015 Update 1 RC.

It worked for me ...

+5
Nov 12 '15 at 7:12
source share

In Visual Studio 2017 (community version), I solved this by switching the version of the Windows SDK to the project properties from 10.0.10586.0 to 10.0.16299.0 (this is the version I installed on my machine).

Here's how:

  • In Visual Studio, navigate to the project properties:

enter image description here

  1. Select the installed version of the SDK:

enter image description here

Link: developer community for VS

+4
Nov 08 '17 at 9:17
source share

If you moved the code from another computer, it may be the wrong SDK on your platform. Check the project properties - General - Windows SDK version and install it in the list shown in the list.

0
Oct 23 '17 at 9:11 on
source share

I am in Windows 8.1 Visual Studio 2017 Professional, and I got it to work after switching project properties. Windows SDK version to version 8.1, build, and then switched to 10.0.16299.0.

I tried to compile a CUDA project.

It worked, don't ask me why. Perhaps this is due to the fact that I have Visual Studio Community 2017, and then uninstall it to install a professional.

0
Oct 27 '17 at 14:55
source share

To solve the problem, you need to find the folder containing the gdi32.lib file

For my system, it is found in C: \ Program Files (x86) \ Windows Kits \ 10 \ Lib \ 10.0.10240.0 \ um \ x86

Just add it to the properties sheet for your project. as described in other Project-> Properties message menus, and then in the VC ++ directories. Add a path up.

0
Dec 29 '17 at 21:04 on
source share

So, I understand that you did not determine the path to your library.

Right click Project -> Properties

In the configuration properties on the "Linker" tab, select "General" in the "Additional library directories", select the path gdi32.lib

enter image description here

Then go to the "Enter" tab (below on the "General" tab) Double-click or select edit to add gdi32.lib

enter image description here

Finally, add your "gdi32.lib", then click "OK."

enter image description here

By the way, in the final edition of Visual Studio 2013, by default it has gdi32.lib

Hope it solves your problem.

-one
Nov 08 '15 at 10:50
source share



All Articles