Fatal error LNK1104: cannot open file 'gdi32.l

2019-02-07 21:55发布

Every time I try to run my code I get this error. I've tried everything, installing the SDK, but I still get 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'm using Windows 7 and Visual Studio 2012.

7条回答
Evening l夕情丶
2楼-- · 2019-02-07 22:47

From what I understand you haven't defined the path of your library.

Right click on Project --> Properties

Under Configuration properties, on "Linker" tab, select "General" on "Additional Library Directories". Select the path of gdi32.lib:

Enter image description here

Then go to the Input tab (below on the General tab).

Double Click or select edit to add gdi32.lib:

Enter image description here

Finally add your "gdi32.lib" and click OK.

Enter image description here

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

I hope it solves your problem.

查看更多
登录 后发表回答