News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

compiling C Windows Code

Started by Statix Star, January 09, 2005, 03:59:30 AM

Previous topic - Next topic

Statix Star

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}


How do I compile this in the cl? I had tried but it gives me an error.

Vortex


C:\Program Files\Microsoft Visual Studio\VC98\Bin>vcvars32.bat
Setting environment for using Microsoft Visual C++ tools.
C:\Program Files\Microsoft Visual Studio\VC98\Bin>cl Hello.c kernel32.lib user32
.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

Hello.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:Hello.exe
Hello.obj
kernel32.lib
user32.lib

C:\Program Files\Microsoft Visual Studio\VC98\Bin>

Jibz

It would be quite helpful if you also pasted the error message you get when asking about an error :U.

One possible problem would be if you were using the VC Toolkit 2003 and didn't install the Platform SDK. The VC Toolkit doesn't include the platform specific header files and libraries, so you need to install the PSDK to get those. I have both installed, and your example compiles fine here.

If you have it installed, it's probably the problem Vortex is refering to, which is strictly speaking a linker error (you need to link with user32.lib).

Statix Star

#3
c.c<1> : fatal error C1083: Cannot open include files: ´windows.h´: No such File
or directory


I had found Windows SDK and it contains what you had said. Also, thanks. The PSDK seems to have a lot of what I want it.

EDIT: LOL When I installed the Windows SDK it didn't worked; I just Installed everything and it worked.

Vortex

Glad to learn that you are O.K with the compiler :U