WinMain help!

This is a discussion on WinMain help! within the C++ Programming forums, part of the General Programming Boards category; I have this code: Code: int main( int argc, char **argv ) { DWORD readerThreadId; HANDLE rc; int opt; const ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,488
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 11:49 AM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21