Code::Blocks Forums

User forums => Help => Topic started by: eagleoneraptor on April 14, 2009, 09:39:58 pm

Title: Using C::B with MS Visual C++ 2008 Express
Post by: eagleoneraptor on April 14, 2009, 09:39:58 pm
Hi people, I had some problems to compile a simple console application with MS Visual C++ 2008 Express and C::B.

The Build log is the following:
Code
cl.exe /nologo /w  /DNDEBUG  /fp:precise /EHs /Ox /Zc:wchar_t /Zc:forScope   /I"C:\Archivos de programa\Microsoft Visual Studio 9.0\VC\include"  /c main.cpp /Foobj\main.obj
main.cpp
link.exe /nologo /LIBPATH:"C:\Archivos de programa\Microsoft Visual Studio 9.0\VC\lib"  /out:"obj\CodeBlocks y VS2005.exe"  obj\main.obj   
LINK : fatal error LNK1104: no se puede abrir el archivo 'kernel32.lib'
I look for kernel32.lib but this but this file not exist in "C:\Archivos de programa\Microsoft Visual Studio 9.0\VC\include"

Any idea?
Thanks!
Title: Re: Using C::B with MS Visual C++ 2008 Express
Post by: polygon7 on April 14, 2009, 11:06:32 pm
Hi,
"kernel32.lib" should be in Platform SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en) LIB directory (usually "c:\Program Files\Microsoft SDKs\Windows\<sdk version>\Lib").

Title: Re: Using C::B with MS Visual C++ 2008 Express
Post by: eagleoneraptor on April 14, 2009, 11:57:16 pm
Thanks man!
But I still with links problems when I try to compile a Win32 API GUI application, the console and standard application compile without problems.
I add the Lib and Include derectory of the Windows SDK to the compiler configuration, but nothing...

The linkers errors are about the API functions: CreateWindowEx, ShowWindow, etc.

Can any help? :)
Bye!
Title: Re: Using C::B with MS Visual C++ 2008 Express
Post by: polygon7 on April 15, 2009, 12:07:20 am
Thanks man!
But I still with links problems when I try to compile a Win32 API GUI application, the console and standard application compile without problems.
I add the Lib and Include derectory of the Windows SDK to the compiler configuration, but nothing...

The linkers errors are about the API functions: CreateWindowEx, ShowWindow, etc.

Can any help? :)
Bye!

CreateWindowEx (http://msdn.microsoft.com/en-us/library/ms632680(VS.85).aspx) and ShowWindow (http://msdn.microsoft.com/en-us/library/ms633548(VS.85).aspx) functions are in user32.lib, use MSDN (http://msdn.microsoft.com/en-us/library/ms633548(VS.85).aspx) to find which functions are in kernel32.lib, user32.lib etc.
Title: Re: Using C::B with MS Visual C++ 2008 Express
Post by: eagleoneraptor on April 15, 2009, 12:19:34 am
Thanks again!!
I'm not include user32.lib to the linker because the accustoming to include the file implicitly.

Bye!
PD: Sorry about my english  :oops:
Title: Re: Using C::B with MS Visual C++ 2008 Express
Post by: davemaster on June 03, 2009, 06:36:25 am
Greetings,

check this location:

C:\Archivos de programa\Microsoft SDKs\Windows\v6.0A\Lib

In my case (visual c++ 2008 express - Windows XP SP2)

Then, as well as the functions you use in your code, you need to link some libraries. Add the location above to your compiler path lib search list: (codeblocks-menu->settings->compiler & debugger->search directories tab->linker.

Best regards.