Re: linker error
On Jul 23, 7:02 pm, "Alf P. Steinbach" <al...@start.no> wrote:
* Victor Bazarov:
[...]
g++ supports standard "main" by default,
Visual C++ supports standard "main" when using appropriate switches (by
default Visual C++ is also non-standard-conforming wrt. exceptions, RTTI
and for-loop syntax, so it must be browbeaten into submission).
Aren't they all? You need -std=c++98 -pedantic with g++, and
God knows how many options with Sun CC. Add to that the fact
that pure C++ compliance locks you out of a lot of Posix, and
what's a programmer to do?
which you don't have and that's what the linker is
complaining about. MS Windows programming is not the same
as just plain programming. That's why you probably want to
set aside the "Windows" side of things for now and switch to
creating what is known as "Console Applications".
Good advice.
I know this is off topic, but the issue comes up so often: what
the hell is a "console application"? How does it differ from
any other application, other than, perhaps, it doesn't use
certain libraries? (In which case, of course, you don't need to
click anything. Just don't include the appropriate headers, nor
link against the corresponding library.)
Unless I've misunderstood something greatly, in the end, an
application is an application. If it invokes some system
function which opens a window, and plays around in it, then it
is a GUI (or Windowing) application, but that's a result of the
code the programmer wrote, and nothing else. The applications I
write don't normally do this: are they automatically console
applications (even if they are started by a cronjob, or at
system start-up, with cin, cout and cerr connected to
"/dev/null")?
I'd add: use command line tools for building.
Is there any other way? All the IDE's that I know (admittedly,
NOT Visual Studio) do is generate command lines.
An IDE adds too much "helpful" stuff that just gets in the way.
:-) Boy can I agree with you there.
At least for production code. I can imagine that when learning,
"one thing at a time" is not a bad policy, and if you could find
an IDE which actually worked correctly and usefully, it would be
nice. But professionally, never.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34