No programs are running.Both is Visual Studio and Codeblocks...

both are showing the following error,
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

I have google it, some say setting environment to "C:\Program Files\Microsoft SDKs\Windows\v5.0" or reinstalling visual studio, or editing registry key "HKEY_CURRENT_USER\SOFTWARE\Microsoft\MicrosoftSDKs\Windows\CurrentInstallFolder"(i didn't find any MicrosoftSDKs under Microsoft) usually solves the problem...

But none of them worked for me...

Can anyone help.This is freaking me out.

Recommended Answers

All 11 Replies

How long has that been happening? Just recently or a very long time? Did you install something that may have affected the compiler's installation? Try reinstalling Visual Studio, uninstall it completely first so that it will reinstall fresh.

Does kernel32.lib actually exist on the computer?

[edit]Oh, I reread your post and see you may have already tried that. Do you also have the Platform SDK installed? If you do then remove it then reinstall it.

How long has that been happening? Just recently or a very long time? Did you install something that may have affected the compiler's installation? Try reinstalling Visual Studio, uninstall it completely first so that it will reinstall fresh.

[edit]Oh, I reread your post and see you may have already tried that. Do you also have the Platform SDK installed? If you do then remove it then reinstall it.

thanks for the reply...i was starting to loose hope.

Well the problem started recently, after I reinstalled my Windows....there is nothing installed that might affect compiler... :(

I have uninstalled and reinstalled VS....but, nothing has changed...

Hi,
I had the same problem when I installed new codeblocks version 10.05 recently. I solved it by entering the complete path to kernel32.lib that way:

1. Identify kernel32.lib
on my computer, also running visual studio2008, I found complete path:
C:\Program files\Microsoft SDKs\Windows\v6.0A\Lib\kernel32.lib

2. on codeblocks v10 choose
Settings->Compiler and debugger-> linker setup
There ADD C:\Program files\Microsoft SDKs\Windows\v6.0A\Lib\kernel32.lib. I also added there odbc.lib to using odbc within c++

Both now work fine. There are no problems with new Visual Studio 2008. The same programs where I had had some trouble on codeblocks with kernel32.lib and odbc run perfectly there.

I hope this will also work on your codeblocks.

-- tesu

[edit]Oh, I reread your post and see you may have already tried that. Do you also have the Platform SDK installed? If you do then remove it then reinstall it.

Do you mean Windows SDK? Yes I think so, I saw something named Windows SDK while installing VS and "C:\Program Files\Microsoft SDKs\Windows" folder contains v5.0 and v.6.0A..total 434MB of files.

I repaired the whole VS again...but, no improvement.

Hi,
I had the same problem when I installed new codeblocks version 10.05 recently. I solved it by entering the complete path to kernel32.lib that way:

1. Identify kernel32.lib
on my computer, also running visual studio2008, I found complete path:
C:\Program files\Microsoft SDKs\Windows\v6.0A\Lib\kernel32.lib

2. on codeblocks v10 choose
Settings->Compiler and debugger-> linker setup
There ADD C:\Program files\Microsoft SDKs\Windows\v6.0A\Lib\kernel32.lib. I also added there odbc.lib to using odbc within c++

Both now work fine. There are no problems with new Visual Studio 2008. The same programs where I had had some trouble on codeblocks with kernel32.lib and odbc run perfectly there.

I hope this will also work on your codeblocks.

-- tesu

this doesn't work...simple

int main{ return 0; }

gives me following error...

LIBCMT.lib(crt0.obj)||error LNK2019: unresolved external symbol __imp__GetCommandLineA@0 referenced in function ___tmainCRTStartup|
LIBCMT.lib(unhandld.obj)||error LNK2019: unresolved external symbol __imp__SetUnhandledExceptionFilter@4 referenced in function ___CxxSetUnhandledExceptionFilter|
LIBCMT.lib(invarg.obj)||error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4|
LIBCMT.lib(abort.obj)||error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4|
LIBCMT.lib(gs_report.obj)||error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4|
LIBCMT.lib(crt0dat.obj)||error LNK2019: unresolved external symbol __imp__GetModuleHandleW@4 referenced in function __crt_waiting_on_module_handle|
LIBCMT.lib(tidtable.obj)||error LNK2001: unresolved external symbol __imp__GetModuleHandleW@4|
LIBCMT.lib(crt0dat.obj)||error LNK2019: unresolved external symbol __imp__Sleep@4 referenced in function __crt_waiting_on_module_handle|
LIBCMT.lib(crtheap.obj)||error LNK2001: unresolved external symbol __imp__Sleep@4|
LIBCMT.lib(crt0dat.obj)||error LNK2019: unresolved external symbol __imp__GetProcAddress@8 referenced in function ___crtCorExitProcess|
LIBCMT.lib(tidtable.obj)||error LNK2001: unresolved external symbol __imp__GetProcAddress@8|
LIBCMT.lib(rand_s.obj)||error LNK2001: unresolved external symbol __imp__GetProcAddress@8|
LIBCMT.lib(crtmbox.obj)||error LNK2001: unresolved external symbol __imp__GetProcAddress@8|
LIBCMT.lib(crt0dat.obj)||error LNK2019: unresolved external symbol __imp__ExitProcess@4 referenced in function ___crtExitProcess|
LIBCMT.lib(crt0msg.obj)||error LNK2019: unresolved external symbol __imp__WriteFile@20 referenced in function __NMSG_WRITE|
LIBCMT.lib(crt0msg.obj)||error LNK2019: unresolved external symbol __imp__GetStdHandle@4 referenced in function __NMSG_WRITE|
LIBCMT.lib(ioinit.obj)||error LNK2001: unresolved external symbol __imp__GetStdHandle@4|
LIBCMT.lib(crt0msg.obj)||error LNK2019: unresolved external symbol __imp__GetModuleFileNameA@12 referenced in function __NMSG_WRITE|
LIBCMT.lib(stdargv.obj)||error LNK2001: unresolved external symbol __imp__GetModuleFileNameA@12|
LIBCMT.lib(a_env.obj)||error LNK2019: unresolved external symbol __imp__FreeEnvironmentStringsA@4 referenced in function ___crtGetEnvironmentStringsA|
LIBCMT.lib(a_env.obj)||error LNK2019: unresolved external symbol __imp__GetEnvironmentStrings@0 referenced in function ___crtGetEnvironmentStringsA|
LIBCMT.lib(a_env.obj)||error LNK2019: unresolved external symbol __imp__FreeEnvironmentStringsW@4 referenced in function ___crtGetEnvironmentStringsA|
LIBCMT.lib(tzset.obj)||error LNK2001: unresolved external symbol __imp__WideCharToMultiByte@32|
LIBCMT.lib(wtombenv.obj)||error LNK2001: unresolved external symbol __imp__WideCharToMultiByte@32|
LIBCMT.lib(a_env.obj)||error LNK2019: unresolved external symbol __imp__WideCharToMultiByte@32 referenced in function ___crtGetEnvironmentStringsA|
LIBCMT.lib(a_loc.obj)||error LNK2001: unresolved external symbol __imp__WideCharToMultiByte@32|
LIBCMT.lib(a_map.obj)||error LNK2001: unresolved external symbol __imp__WideCharToMultiByte@32|
LIBCMT.lib(convrtcp.obj)||error LNK2001: unresolved external symbol __imp__WideCharToMultiByte@32|
LIBCMT.lib(a_map.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(a_str.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(a_cmp.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(inithelp.obj)||error LNK2019: unresolved external symbol __imp__GetLastError@0 referenced in function ___getlocaleinfo|
LIBCMT.lib(free.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(a_loc.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(realloc.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(a_env.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(tidtable.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(winsig.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(rand_s.obj)||error LNK2001: unresolved external symbol __imp__GetLastError@0|
LIBCMT.lib(a_env.obj)||error LNK2019: unresolved external symbol __imp__GetEnvironmentStringsW@0 referenced in function ___crtGetEnvironmentStringsA|
LIBCMT.lib(ioinit.obj)||error LNK2019: unresolved external symbol __imp__SetHandleCount@4 referenced in function __ioinit|
LIBCMT.lib(ioinit.obj)||error LNK2019: unresolved external symbol __imp__GetFileType@4 referenced in function __ioinit|
LIBCMT.lib(ioinit.obj)||error LNK2019: unresolved external symbol __imp__GetStartupInfoA@4 referenced in function __ioinit|
LIBCMT.lib(ioinit.obj)||error LNK2019: unresolved external symbol __imp__DeleteCriticalSection@4 referenced in function __ioterm|
LIBCMT.lib(mlock.obj)||error LNK2001: unresolved external symbol __imp__DeleteCriticalSection@4|
LIBCMT.lib(tidtable.obj)||error LNK2019: unresolved external symbol __imp__TlsGetValue@4 referenced in function __encode_pointer|
LIBCMT.lib(tidtable.obj)||error LNK2019: unresolved external symbol __imp__TlsAlloc@0 referenced in function ___crtTlsAlloc@4|
LIBCMT.lib(tidtable.obj)||error LNK2019: unresolved external symbol __imp__TlsSetValue@8 referenced in function ___set_flsgetvalue|
LIBCMT.lib(tidtable.obj)||error LNK2019: unresolved external symbol __imp__TlsFree@4 referenced in function __mtterm|
LIBCMT.lib(tidtable.obj)||error LNK2019: unresolved external symbol __imp__InterlockedIncrement@4 referenced in function __initptd|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Start a new project that only contains main(). The errors you posted appear as if there are other *.cpp files in the project.

Start a new project that only contains main(). The errors you posted appear as if there are other *.cpp files in the project.

it is one file and a single line of code...

I'll bet the file is including windows.h ???? One of the errors references a function Sleep() that is in that header file. Remove all the include files from that *.cpp file.

I'll bet the file is including windows.h ???? One of the errors references a function Sleep() that is in that header file. Remove all the include files from that *.cpp file.

seriously, this *.cpp file includes only the following line...

int main{ return 0; }

N.B. I am in Codeblocks and i have changed the settings of linker as tesuji suggested.

seriously, this *.cpp file includes only the following line...

int main{ return 0; }

N.B. I am in Codeblocks and i have changed the settings of linker as tesuji suggested.

>>> int main{ return 0; } ???


So what about this one:

int main(){return 0;}

tesu

>>> int main{ return 0; } ???


So what about this one:

int main(){return 0;}

tesu

Sorry, somehow the brackets was missed while typing.But i reopen the last file and there was brackets.

The problem has been solved, but in a weird manner,
1. I uninstalled the pro edition of VS and then installed the express edition(2008).
2. Then i uninstalled the express edition and reinstalled the pro edition, then everything became ok.

3. But the codeblocks issue was not solved, I have to relocate the kerner32.lib to make it work.

The interesting thing in the process is that, the folder structure inside the Microsoft SDK\Windows folder has been changed.

When the problem existed there was two folder one names, "v5.0 " and other named "v6.0A"
"v5.0" contained two folders, Include and Lib, where this lib contains Kernel32.lib.I added this kerner32.lib(from v5.0\lib) to codeblock, which didn't work."v6.0" contained only "bin" & "Bootstrapper".

But when I went through, the VS's Pro and express installation and uninstallation procedure, there were added two more folders inside "v6.0A" folder.They are Include & Lib.

Now, when I relocated kerner32.lib(from v6.0A\lib) in the linker setup of codeblocks, everything worked fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.