Thread: WinMain help!

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    7

    WinMain help!

    I have this code:
    Code:
     int main( int argc, char **argv )
    {
        DWORD       readerThreadId;
        HANDLE      rc;
        int         opt;
        const char *baudStr = NULL;
        const char *portStr = "com1";
    
    
        PKT_TextChar        = PacketTextChar;
        PKT_SendChar        = PacketSendChar;
        PKT_PacketReceived  = PacketReceived;
    
        LogInit( stdout );
    
        while (( opt = getopt_long( argc, argv, "b:dhmp:sv", gLongOption, NULL )) > 0 )
        {
            switch ( opt )
    after that there is a bunch of case statements that are irrelevent. My problem is that after compilation if gives this error

    "error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup"

    I have looked at a few different pages and I cant seem to figure out how to write this so that it works. I know about WinMain and its parameters, but my main function has its own parameters and I dont know what to do with those. Any help would be greatly appreciated!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Recreate your project as a console project, not as a GUI project.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WinMain entry point in .lib
    By cloudy in forum Windows Programming
    Replies: 8
    Last Post: 10-28-2006, 12:16 PM
  2. WinMain Paramaters.
    By C+noob in forum Windows Programming
    Replies: 8
    Last Post: 07-11-2005, 11:44 AM
  3. Understanding the Window WinMain Cycle
    By BillBoeBaggins in forum Windows Programming
    Replies: 4
    Last Post: 12-06-2003, 12:49 PM
  4. Silly WinMain question
    By Magos in forum Windows Programming
    Replies: 2
    Last Post: 09-07-2002, 09:38 AM
  5. Is this necessary: int APIENTRY WinMain
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 06-26-2002, 07:09 PM