On Apr 19, 10:55 am, "Alf P. Steinbach" <a...@start.nowrote:
* James Kanze:
On Apr 18, 8:01 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
This is off-topic here (linking and make are not part of C++
specification), but have you added your 'cpp' file to the link
command in your makefile?
This is getting a bit ridiculous. The exact details on how to
invoke the linker (and how to ensure that it finds the specific
object file) may not be on topic, but the fact that you link,
and that you have to include the compiled .cpp file in your
program, definitly is. (Even the standard talks about it.)
I agree, it would be ridiculuous if we couldn't discuss the reality of
linking, or for that matter matching C++ code to machine
characteristics. But there we have an educational problem, because the
FAQ equates clc++ topicality with what can be answered by reference to
the standard, and only that.
The charter doesn't put it in those terms. The topic here is
C++, as opposed to Microsoft Windows, or whatever. The
classical test was simple: if the answer would be the same for
all languages, but not for different platforms, it's off topic.
If the answer would be the same for all platforms, but not for
other languages, it's on topic. Here, there were aspects of
both involved. Details as to how to invoke a specific linker,
etc., are not really on topic (although there are even fairly
portable aspects of that). The fact that C++ does statically
link to an executable (in all, or almost all
implementations---the standard doesn't require it), instead of
e.g. being delivered in the form of a jar file, or whatever, is
on topic.
For me, the question seemed on topic because 1) I use exactly
the same techniques for deploying C++ programs under Solaris,
Linux and Windows, and 2) I use different techniques for Java.
In sum, the answer depends on the language, and not the
platform or the compiler. (It's a bit less clear than some
cases, of course, because there is a large family of languages
which use the same techniques: C, Ada, Fortran, etc. But still,
the problem the OP had was that the technique he used in Basic
wasn't available.)
So, herewith, Alf's proposal for clc++ topicality, guideline for clc++
topicality police (whenever one feels like putting that uniform on):
(
* Is of general interest to C++ programmers in general
-- and --
* Is not completely environment-specific (in particular, isn't about
how to use some library which usage problem could just as well be
expressed in terms of some other language than C++),
-- or --
* Is a follow-up in a thread, with at least some C++ related content.
)
-- and --
* Does not constitute a personal attack, is not spam, etc.
Is this OK? I just poured that out of my shirtsleeve. May have missed
something.
It looks fine to me. There will be borderline cases, of course,
but I'm sure you're aware of that.
There's also a question in my mind about specific compiler
invocation sequences, when a de facto standard has developped.
The issue came up in another thread: in 25 years of C/C++, I've
never encountered a compiler where -I couldn't be used to
specify an include path. Now, I agree that normally,
implementation specific details of how to invoke the compiler
are off topic (except maybe as examples), but I do rather feal
some exceptions are in order: when the option is
quasi-universal, like -I, or when it is related to handling a
more general problem, things like -ffloat-store with g++, for
example (which is an aspect of the more general problem of why
floating point arithmetic doesn't give the expected results).
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34