BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unresolved External Main?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools)
View previous topic :: View next topic  
Author Message
John Fry
Guest





PostPosted: Sun Jan 25, 2004 3:05 am    Post subject: Unresolved External Main? Reply with quote



Can anybody help me? I'm a newbie, using Borland's Command-line compiler and
I've been able to compile and run programs using the console mode. But
whenever I try to compile a Windows Application in console mode I receive
the error message --
"Error: Unresolved External '_main' referenced from
C:BorlandBCC55LIBc0x32.OBJ"

The following are the include statements that I am using. "ray.h" is from an
EZWindows Package that I have.

// PhoneNumber.cpp
#include <iostream>
#include <fstream>
#include <string>
#include "ray.h"

using namespace std;
int ApiMain(void)

And I use the following command to compile.
bcc32 -WC -Ic:borlandezwininclude -Lc:borlandezwinlib PhoneNumber.cpp

This is a simple little program that reads a number from a file and displays
it in a window. Any help would be greatly appreciated. Many thanks in
advance.

John


Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Sun Jan 25, 2004 4:13 am    Post subject: Re: Unresolved External Main? Reply with quote



Console mode programs begin at the function main, the function the error
statement says it cannot find. Your message says that you have provided
ApiMain. The compiler attaches no special significance to that function.

You also mention something called EZWindows. I did a web search for the
word EZWindows and found a page on a software package from the U of Virginia
CS dept with installation versions for MS and Borland compilers.

If ApiMain is what that package requires then there must be a library
associated with that package, a library that supplies the function main. If
so then the compiler must be told to use that library by putting the library
name on the command line to the right of any source and object file names
(complete with the .lib extension in the name).

The command line you show is unnecessarily complex.
Quote:
bcc32 -WC -Ic:borlandezwininclude -Lc:borlandezwinlib
PhoneNumber.cpp


Edit the c:borlandbcc55binbcc32.cfg file and change these lines from
-Ic:borlandbcc55include
-Lc:borlandbcc55lib
to
-Ic:borlandbcc55include;c:borlandezwininclude
-Lc:borlandbcc55lib;c:borlandezwinlib

Edit the c:borlandbcc55binilink32.cfg file and change this line from
-Lc:borlandbcc55lib
to
-Lc:borlandbcc55lib;c:borlandezwinlib

Do not overlook the semicolon between the two path elements in each of those
lines.

This change will add the ezwin include and lib directories to the defaults
used by the compiler. After making the changes the -I and -L directives
should no longer be needed on the command line.

The compiler assumes that any file whose name does not have an extension
will have an extension of .cpp

If the ezwindows library name is ezwindows.lib and the above changes are
made then the command to build it as a console mode program might look like
this:

bcc32 -WC phonenumber exwindows.lib

.. Ed

Quote:
John Fry wrote in message
news:4013328c (AT) newsgroups (DOT) borland.com...

Can anybody help me? I'm a newbie, using Borland's
Command-line compiler and I've been able to compile and
run programs using the console mode. But whenever I try
to compile a Windows Application in console mode I
receive the error message --
"Error: Unresolved External '_main' referenced from
C:BorlandBCC55LIBc0x32.OBJ"

The following are the include statements that I am using.
"ray.h" is from an EZWindows Package that I have.

// PhoneNumber.cpp
#include #include #include #include "ray.h"

using namespace std;
int ApiMain(void)

And I use the following command to compile.
bcc32 -WC -Ic:borlandezwininclude -Lc:borlandezwinlib
PhoneNumber.cpp

This is a simple little program that reads a number from a file
and displays it in a window. Any help would be greatly
appreciated. Many thanks in advance.



Back to top
John Fry
Guest





PostPosted: Sun Jan 25, 2004 5:34 pm    Post subject: Re: Unresolved External Main? Reply with quote



Thanks again for the speedy and accurate assistance. After making the
changes that you provided, the programs compile and run like they should.
You must have a keen eye for compiling errors.

John

"Ed Mulroy [TeamB]" <dont_email_me (AT) bitbuc (DOT) ket> wrote

Quote:
Console mode programs begin at the function main, the function the error
statement says it cannot find. Your message says that you have provided
ApiMain. The compiler attaches no special significance to that function.

You also mention something called EZWindows. I did a web search for the
word EZWindows and found a page on a software package from the U of
Virginia
CS dept with installation versions for MS and Borland compilers.

If ApiMain is what that package requires then there must be a library
associated with that package, a library that supplies the function main.
If
so then the compiler must be told to use that library by putting the
library
name on the command line to the right of any source and object file names
(complete with the .lib extension in the name).

The command line you show is unnecessarily complex.
bcc32 -WC -Ic:borlandezwininclude -Lc:borlandezwinlib
PhoneNumber.cpp

Edit the c:borlandbcc55binbcc32.cfg file and change these lines from
-Ic:borlandbcc55include
-Lc:borlandbcc55lib
to
-Ic:borlandbcc55include;c:borlandezwininclude
-Lc:borlandbcc55lib;c:borlandezwinlib

Edit the c:borlandbcc55binilink32.cfg file and change this line from
-Lc:borlandbcc55lib
to
-Lc:borlandbcc55lib;c:borlandezwinlib

Do not overlook the semicolon between the two path elements in each of
those
lines.

This change will add the ezwin include and lib directories to the defaults
used by the compiler. After making the changes the -I and -L directives
should no longer be needed on the command line.

The compiler assumes that any file whose name does not have an extension
will have an extension of .cpp

If the ezwindows library name is ezwindows.lib and the above changes are
made then the command to build it as a console mode program might look
like
this:

bcc32 -WC phonenumber exwindows.lib

. Ed





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.