public inbox for cygwin-talk@cygwin.com
 help / color / mirror / Atom feed
From: "Dave Korn" <dave.korn@artimi.com>
To: "'are you listening carefully?'" <cygwin-talk@cygwin.com>
Subject: RE: how come #include "*.cpp" works?
Date: Wed, 17 May 2006 17:01:00 -0000	[thread overview]
Message-ID: <000801c679d3$7e602b90$a501a8c0@CAM.ARTIMI.COM> (raw)
In-Reply-To: <e4fgat$8nd$1@sea.gmane.org>

On 17 May 2006 16:43, mwoehlke wrote:

> Larry Hall (Cygwin) wrote:
>> This isn't a Cygwin specific problem so it's off-topic for this list.
>> Please find a better forum for such questions.  If you feel you must
>> continue this discussion with a Cygwin crowd, then you can try the
>> cygwin-talk list.

  BTW, an interesting point arises from that thread:

  Everyone who replied chimed in with advice that the problem resulted from a
doubled include, and showed the OP how to use include guards to prevent the
resultant duplicate redefinitions.

  However,

1)  The OP was reporting *UN*defined symbol errors, not multiply-defined
errors;
2)  Nothing was being repeatedly included; each .cpp #included the header just
once, correctly;
3)  The division of declarations in the header file and definitions in the
.cpp file was completely correct; there are no definitions in the header so
nothing would get instantiated in both modules and cause a link error;
4)  The testcase compiles and runs fine!

  The only thing I can imagine is that OP got his compile command-lines messed
up, and was trying to fully compile-and-link each of the modules separately,
having missed out the -c option; so it compiled OK but then got link errors at
the end of the build.  When one .cpp was included in the other, the whole
thing was complete and all the links resolved.

  So, I think Larry should have written something more like

>> This isn't a Cygwin specific problem so it's off-topic for this list.
>> Please find a better forum for such questions, because nobody's
>> actually paying sufficient attention here.  If you feel you must
>> continue this discussion with a Cygwin crowd, then you can try the
>> cygwin-talk list, because irrelevant advice about dropping a hippo
>> on it is probably preferable to realistic-seeming yet completely
>> misleading advice.

  I guess if you've got a hammer, and every problem looks like a nail, then
everything that goes wrong is going to look like hitting your thumb....

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

      parent reply	other threads:[~2006-05-17 17:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <44638BED.5020009@telenet.be>
     [not found] ` <4463A0D4.1060006@cygwin.com>
2006-05-17 15:52   ` mwoehlke
2006-05-17 16:00     ` Dave Korn
2006-05-17 16:28       ` Igor Peshansky
2006-05-17 16:57         ` Dave Korn
2006-05-18 14:46       ` mwoehlke
2006-05-18 16:59         ` Jason Alonso
2006-05-18 17:24         ` Dave Korn
2006-05-18 18:28           ` mwoehlke
2006-05-18 18:31             ` Dave Korn
2006-05-18 19:10               ` mwoehlke
2006-05-24 16:03         ` mwoehlke
2006-05-24 17:14           ` Dave Korn
2006-05-24 17:28             ` Igor Peshansky
2006-05-24 17:51               ` Dave Korn
2006-05-24 18:36               ` mwoehlke
2006-05-24 18:17             ` mwoehlke
2006-05-17 17:01     ` Dave Korn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000801c679d3$7e602b90$a501a8c0@CAM.ARTIMI.COM' \
    --to=dave.korn@artimi.com \
    --cc=cygwin-talk@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).