Thread: compiling without main()

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    18

    compiling without main()

    hi all!
    I'm using Borland C++ Compiler. I downloaded a source code from the web but I couldn't compile it...
    :-(

    Code:
    bcc32 LogIEUrlrRequests.cpp
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    logieurlrrequests.cpp:
    Warning W8066 logieurlrrequests.cpp 123: Unreachable code in function __stdcall
    WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)
    Warning W8057 logieurlrrequests.cpp 124: Parameter 'hInstance' is never used in
    function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)
    Warning W8057 logieurlrrequests.cpp 124: Parameter 'hPrevInstance' is never used
     in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)
    Warning W8057 logieurlrrequests.cpp 124: Parameter 'lpCmdLine' is never used in
    function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)
    Warning W8057 logieurlrrequests.cpp 124: Parameter 'nCmdShow' is never used in f
    unction __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    Error: Unresolved external '_main' referenced from D:\BCC55\LIB\C0X32.OBJ
    Do you guys know a C/C++ compiler tutorial for beginners?
    Thanks a lot!!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It looks like you have a Win32 application and you're trying to compile it as a console application. This is a common problem, just create a new project that is strictly Win32.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    But BCC should compile it? Isn't BCC a 32bit Cpp compiler?
    just create a new project that is strictly Win32
    How do I do that?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >But BCC should compile it? Isn't BCC a 32bit Cpp compiler?
    When I say a Win32 application I mean a graphical application with windows. A console application is text based and runs in the DOS-like prompt. The two really are very different.

    >How do I do that?
    Read your compiler's documentation.
    My best code is written with the delete key.

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Code:
    Syntax is: BCC32 [ options ] file[s]     * = default; -x- = turn switch x off
      -3    * 80386 Instructions        -4      80486 Instructions
      -5      Pentium Instructions      -6      Pentium Pro Instructions
      -Ax     Disable extensions        -B      Compile via assembly
      -C      Allow nested comments     -Dxxx   Define macro
      -Exxx   Alternate Assembler name  -Hxxx   Use pre-compiled headers
      -Ixxx   Include files directory   -K      Default char is unsigned
      -Lxxx   Libraries directory       -M      Generate link map
      -N      Check stack overflow      -Ox     Optimizations
      -P      Force C++ compile         -R      Produce browser info
      -RT   * Generate RTTI             -S      Produce assembly output
      -Txxx   Set assembler option      -Uxxx   Undefine macro
      -Vx     Virtual table control     -X      Suppress autodep. output
      -aN     Align on N bytes          -b    * Treat enums as integers
      -c      Compile only              -d      Merge duplicate strings
      -exxx   Executable file name      -fxx    Floating point options
      -gN     Stop after N warnings     -iN     Max. identifier length
      -jN     Stop after N errors       -k    * Standard stack frame
      -lx     Set linker option         -nxxx   Output file directory
      -oxxx   Object file name          -p      Pascal calls
      -tWxxx  Create Windows app        -u    * Underscores on externs
      -v      Source level debugging    -wxxx   Warning control
      -xxxx   Exception handling        -y      Produce line number info
      -zxxx   Set segment names
    
    E:\>cpp32
    Borland C++ Win32 Preprocessor 5.5.1 Copyright (c) 1993, 2000 Borland
    Syntax is: CPP32 [ options ] file[s]     * = default; -x- = turn switch x off
      -Ax     Disable extensions        -C      Allow nested comments
      -Dxxx   Define macro              -Ixxx   Include files directory
      -P    * Include source line info  -Sc     Keep comments
      -Sd     Defines/undefs in output  -Sg     Display fast guard details
      -Sk     Keep output on errors     -Sr     Readable commented output
      -Ss     Give header statistics    -Uxxx   Undefine macro
      -gnnn   Stop after N warnings     -idl    Accept some IDL syntax
      -innn   Max. identifier length N  -jnnn   Stop after N errors
      -nxxx   Output file directory     -oxxx   Output file name
      -p      Pascal calls              -w      Enable all warnings
      -wxxx   Enable warning xxx        -w-xxx  Disable warning xxx
    which parameters should i use?

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    108
    bcc32 -tW -w-par LogIEUrlrRequests.cpp
    Last edited by DarkStar; 09-07-2003 at 06:28 PM.

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>which parameters should i use?
    How about the one that says "create windows app"?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    thank you guys!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. compiling main first...
    By hubris in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-31-2009, 05:03 PM
  2. Replies: 7
    Last Post: 10-15-2008, 03:38 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Return Statement
    By Daveo in forum C Programming
    Replies: 21
    Last Post: 11-09-2004, 05:14 AM
  5. void main
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 05-29-2002, 07:08 PM