Eclipse can't link to kernel32.lib
Solution 1
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.
Solution 2
I've the same problem, I've fixed because of installed Microsoft Visual Studio 2010 on my computer:
- Right click on your
C/C++ project -> Properties -> C/C++ Build -> Environment
- In
LIB
, click on the ButtonEdit
on the right side - 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 *
Solution 3
you need to add the path to the library to your project, from the FAQ
Go to Your Project's Properties by right clicking on project's name and selecting properties. Click on "C/C++ Build". Under Tool Settings Tab, click on Directories. Click on The Add Button and Select FileSystem. Select the folder with C/C++ libraries. Apply and then Ok. The new library is included.
Edit:
The wiki seems outdated, but I did find the options relevant to linking here:
C/C++ Build->Settings->Tool Settings tab
you should add the include paths for headers (if any) to the compiler Includes
and the libraries to the linker options Libraries(-l)
and the library path to Library Search path (-L)
Itamar
My name is Itamar , I'm mostly interested in PHP, MySql and jQuery, always willing to be exposed to new programming languages and attitudes.
Updated on August 03, 2022Comments
-
Itamar almost 2 years
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 runC
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. -
Kiril Kirov over 11 yearsA quote would make your answer a lot better.
-
Itamar over 11 yearsThe problem is that there isn't any "Tool Settings" tab under C/C++ Build ( I use eclipse indigo ) @mux
-
Itamar over 11 years@mux , thanks for the answer, the kernel32.lib error is now gone , but a new error came up : now 'C:\Program.obj' is missing. any ideas ? Thanks again