Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse can't link to kernel32.lib

I've installed Eclipse CDT so I'll be able to write and compile C code.

The compilation progress fails and the following error appears:

LNK1104 : cannot open file kernel32.lib

I've been searching for this file in my computer and found out it appears in some folders,

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib

How could I "refer" eclipse to one of this certain paths so the kernel32.lib file will be found and I'll be able to compile and run C files?

EDIT Thanks to @mux answer the LNK1104 : cannot open file kernel32.lib is now gone , but a new error appears now : LNK1104 : cannot open file 'C:\Program.lib' . Once again, any suggestion will be helpful.

like image 275
Itamar Avatar asked Oct 30 '12 09:10

Itamar


Video Answer


2 Answers

i wasted a lot of time on this... this is the answer you are searching for

In Eclipse > Project > Properties > Paths and Symbols > Libraries tab, enclose the path to the library in single quotes:

'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\Kernel32.Lib'

There would be a warning that the path does not exist, but it should be gone after you rebuild your project.

like image 186
Shivendra Avatar answered Oct 13 '22 12:10

Shivendra


I've the same problem, I've fixed because of installed Microsoft Visual Studio 2010 on my computer:

  1. Right click on your C/C++ project -> Properties -> C/C++ Build -> Environment
  2. In LIB, click on the Button Edit on the right side
  3. Add ;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib <---- ; to separate the first auto detected path"

* Must be on the both Debug and Release configuration : else you'll get the same error *

like image 27
naoufelabs Avatar answered Oct 13 '22 11:10

naoufelabs