Thread: Problem with Borland 5.5 Compiling Windows Programs

  1. #1
    Unregistered
    Guest

    Unhappy Problem with Borland 5.5 Compiling Windows Programs

    I am having trouble compiling a sample program from an online tutorial I am working on. It's an extremely simple program.

    #include <windows.h>

    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
    MessageBox(NULL, "Hello world!", "Sample", MB_OK);
    return 0;
    }


    I compile it using the following line as the tutorial said:

    bcc32 -W -laa wintest.cpp

    I get 4 errors, 1 for each input to WinMain:
    Error E2287 wintest.cpp 3: Parameter 1 missing name in function WinMain
    Error E2287 wintest.cpp 3: Parameter 2 missing name in function WinMain
    Error E2287 wintest.cpp 3: Parameter 3 missing name in function WinMain
    Error E2287 wintest.cpp 3: Parameter 4 missing name in function WinMain

    I can't figure out what the problem is, because I am a complete newbie to windows programming and all of this is foreign to me.

    By the way, when I run the program as a console proggy it works just fine. It's only when I use WinMain that it gets angry.

    I appreciate your assistance in advance.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Code:
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) 
    { 
    MessageBox(NULL, "Hello world!", "Sample", MB_OK); 
    return 0; 
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    The code he posted
    Code:
    #include <windows.h> 
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) 
    {
    MessageBox(NULL, "Hello world!", "Sample", MB_OK);
    return 0; 
    }
    Should work with c++ not c.
    Try a compile with bcc32 -tW wintest.cpp

  4. #4
    Unregistered
    Guest

    Post

    Thanks for your help!

    By the way, -tW doesn't work, but on your suggestion that it should work with C++ the following:

    bcc32 -W -P wintest.cpp

    DOES work. For me, -tW and -W do exactly the same thing, doesn't seem like it should be that way, but ah well what can you do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc compiling and linking problem
    By maven in forum C Programming
    Replies: 6
    Last Post: 11-14-2008, 05:28 AM
  2. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  5. SDI Menu problem - Windows MSVC 6.0
    By Brown Drake in forum C++ Programming
    Replies: 0
    Last Post: 10-13-2001, 06:04 AM