473,802 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linker error

Hi,

I just started to get a grip on C++ and and went through the tutorial.
However, not even the standard "hello world" exercise works out :( I
do get a linker error "[Linker Error] Unresolved external 'WinMain'
referenced from C:\PROGRAM FILES\BORLAND\C BUILDER5\LIB\C0 W32.OBJ"

my code (Borland C++ builder 5) is as follows:
#include <condefs.h>
#include <iostream.h>
#include <conio.h>
#pragma hdrstop

//---------------------------------------------------------------------------
int main (int argc, char **argv)
{
cout << "Hello World!" << endl;
cout << endl << "press any key to continue...";
getch();
return 0;
}
Any idea?

THANKS!

kath

Jul 23 '07
12 7730

James Kanze <ja*********@gm ail.comwrote in message...
...., and I rarely use Windows.
Ah, so you are the guy that dropped B. Gates to number 2 in the 'worlds
richest' list!! <G>
Good job, friend!

--
Bob R
POVrookie
Jul 26 '07 #11
In article <11************ **********@k79g 2000hse.googleg roups.com>,
ja*********@gma il.com says...
On Jul 25, 6:47 pm, Jerry Coffin <jcof...@taeus. comwrote:
[ ... ]
What's a PE file? And what do you mean by "optional header"?
I'm sure that .exe file have a specific format, just as a.out
files do under Unix; do you mean a header section in this
format?
Sorry -- PE is "Portable Executable" format, which is a variation on
COFF, and yes, it's the current format for Windows executables. COFF
defines a couple of fields for what it calls an optional header -- but
to be a PE file, that optional header has to be included in a specific
format.

[ ... ]
That means portable code that uses 'main' will become a console
subsystem program unless you specify otherwise.

But I can specify otherwise. Why not?
I'm not sure I follow. Why not what? If you mean, why wouldn't you do
that, the main reason would be that you plan to use the console streams,
so you want them set up by default, which will happen if it's marked for
the console subsystem, but not if it's marked for the windows subsystem
(at least the startup code supplied by the compilers I've looked at
didn't do include that by default...)

[ ... ]
That's what I'd always thought. (On the other hand, there are
significant differences between the way Windows handles .dll's,
and Unix handles .so's. My impression, in fact, is that they
are much like the differences between how the systems handle the
way you start a program. Under Windows, the decisions are
handled upstream, by the person who provides the program/DLL;
under Unix, they're made by the user, when he uses it.)
I'm not sure I understand exactly what differences you're talking about
here...

[ ... ]
As far as sophistication goes, I suspect it's a much a matter of
viewpoint as anything else -- when I run Unix (or Linux, BSD, etc.) I
get the feeling of having just stepped back 10 or 15 years as well...

With regards to what? I don't have the applications that I have
under Windows, or they don't look as sleek, but at the system
level, I've got a lot more functionality: multiple desktops,
windows on many different machines, etc.
Well, to continue one of your examples, Windows does support multiple
desktops -- but I haven't been able to find X/Unix functionality similar
to the multiple window stations supported by Windows. Under Windows,
each desktop lives in a window station. Most "global" objects like the
clipboard are only really shared among the desktops in a window station.
Under X, the clipboard is managed by a process of its own, but I haven't
seen a capability to designate (for example) that these three desktops
share one clipboard, while those two share a different one.

[ ... ]
This _is_ somewhat different: Windows only provides on way to start a
program, but it does NOT map to much of anything. The real entry point
for a program always has the signature 'unsigned int entryPoint(void )'.
It's (always) up to some code in the program itself to do things like
retrieving and parsing its command line, if it chooses to do so at all.

All of which is transparent to the C++ programmer, of course:-).
Yes -- unless he chooses to get involved, of course.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 26 '07 #12
On Jul 26, 10:55 pm, Jerry Coffin <jcof...@taeus. comwrote:
In article <1185464835.026 416.133...@k79g 2000hse.googleg roups.com>,
james.ka...@gma il.com says...
On Jul 25, 6:47 pm, Jerry Coffin <jcof...@taeus. comwrote:
[ ... ]
That means portable code that uses 'main' will become a console
subsystem program unless you specify otherwise.
But I can specify otherwise. Why not?
I'm not sure I follow. Why not what?
Just "why not?" Why not do it like Microsoft does? It's no
worse (nor any better) than some other solutions.
[ ... ]
That's what I'd always thought. (On the other hand, there are
significant differences between the way Windows handles .dll's,
and Unix handles .so's. My impression, in fact, is that they
are much like the differences between how the systems handle the
way you start a program. Under Windows, the decisions are
handled upstream, by the person who provides the program/DLL;
under Unix, they're made by the user, when he uses it.)
I'm not sure I understand exactly what differences you're talking about
here...
The fact that with Windows DLL's, you specify which symbols are
exported in the source file, using language extension (or in a
second file, which will be read by the linker), where as with
Unix, you specify whether other so's can see the symbols in your
so by means of an option to dlopen, when you load the object.
Under Windows, the author of the dynamically linked object
chooses what will and what will not be visible; under Unix, the
user chooses when loading the object. (But that's a radical
simplification, of course.)
[ ... ]
As far as sophistication goes, I suspect it's a much a matter of
viewpoint as anything else -- when I run Unix (or Linux, BSD, etc.) I
get the feeling of having just stepped back 10 or 15 years as well...
With regards to what? I don't have the applications that I have
under Windows, or they don't look as sleek, but at the system
level, I've got a lot more functionality: multiple desktops,
windows on many different machines, etc.
Well, to continue one of your examples, Windows does support multiple
desktops -- but I haven't been able to find X/Unix functionality similar
to the multiple window stations supported by Windows. Under Windows,
each desktop lives in a window station. Most "global" objects like the
clipboard are only really shared among the desktops in a window station.
Under X, the clipboard is managed by a process of its own, but I haven't
seen a capability to designate (for example) that these three desktops
share one clipboard, while those two share a different one.
I'm not sure what the difference is under Windows, but it sounds
like you've basically got two different terminals under X. (A
terminal under X can have more than one screen.)
[ ... ]
This _is_ somewhat different: Windows only provides on way to start a
program, but it does NOT map to much of anything. The real entry point
for a program always has the signature 'unsigned int entryPoint(void )'.
It's (always) up to some code in the program itself to do things like
retrieving and parsing its command line, if it chooses to do so at all.
All of which is transparent to the C++ programmer, of course:-).
Yes -- unless he chooses to get involved, of course.
Agreed. (IMHO: Not having access to the actual command line
is a flaw in the Unix design. There are cases where you want to
differ e.g. filename expansion; under MS-DOS, I had a library
which broke up the command line something like the way Unix
does, including expansion of things like *.c. And one of my
"standard" options was -R, which means recurse on the current
directory, expanding the filenames in all of its subdirectories
as well. And a -o option which would accept such names as well,
mapping each input filename to a corresponding output filename.)

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 27 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
801
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions Guide" Using Dev-C++ 4.9.9.2, The error is: undefined reference to ‘f(int)’ all the following files are in the same dir. thanks
1
5012
by: Laszlo | last post by:
Hi all, As a novice I installed PostgreSQL 7.2.1 on Win32 and works, Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. I decided to combine these two programs and develop a simple GUI app to display datas queried from PostgreSQL. I did make the following changes in the project's settings: Project->Properties->Directories->Include path += C:\Program
5
6055
by: Pradnyesh Rane | last post by:
Hi, I am encountering the following linker error on VC7. LINK : fatal error LNK1171: unable to load ole32.dll This error is only encountered for the "Debug" configuration. The project successfully compiles/links in "Release" configuration. Any help is welcome.
3
1780
by: Steve Baer | last post by:
I recently read your whitepaper under the "extremely long link times" post and have a question that I was hoping you could answer. My question is based on the following paragraph: Directives The linker's handling of directives left something to be desired in VC2003, and for this reason code with lots of directives can suffer. In particular __declspec(export), as it's likely the most common linker directive. Besides that, don't export...
9
2015
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but not sure how. It compiled just fine. Then I made a simple change and re-compiled, and got the 1215 error. After that I have to bring back in an old version of the code to make it work again (not fun)... This seems like a REAL LINKER error, not...
3
8090
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error LNK2028: unresolved token (0A000007) "extern "C" void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)" (?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public: virtual __thiscall...
1
2272
by: Felix | last post by:
After porting a project from VC6 to VC.NET 2003 I have a very strange problem generating link error 1104 for import libraries. I just ported the project and made some small adaptions so it fits the new IDE. The project itself links against some import libraries belonging to dll's I wrote (these dll's have been ported too, of course). To keep things simple I only use one import library here. To tell the linker it should link against
4
29322
by: yOtA | last post by:
I get this Linker Errors while compiling my program: Error: Unresolved external 'vminit()' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'vmalloc(void *, int, unsigned int, unsigned int)' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'vmcomplete(void *)' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'LogError(char *, int, char *, int)' referenced from C:\TESTE\TESTE.OBJ
1
4166
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- Error: Unresolved external 'ImqMgr::~ImqMgr()' referenced from C:\DOCUMENTS AND SETTINGS\228753\MY DOCUMENTS\BORLAND STUDIO PROJECTS\DLLEXERCISE\DEBUG_BUILD\MANI.OBJ Error: Unresolved external 'ImqObj::~ImqObj()' referenced from C:\DOCUMENTS AND...
3
3603
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10535
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10061
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.